Commit 5b560a6b authored by itcast's avatar itcast
parents f994cfa9 2b619e75
......@@ -60,11 +60,7 @@
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.4.1</version>
</dependency>
<!--<dependency>-->
<!--<groupId>com.github.pagehelper</groupId>-->
<!--<artifactId>pagehelper</artifactId>-->
<!--<version>5.2.0</version>-->
<!--</dependency>-->
<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper-spring-boot-starter -->
<dependency>
<groupId>com.github.pagehelper</groupId>
......@@ -122,18 +118,6 @@
<version>5.7.16</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-redis</artifactId>-->
<!-- <version>1.4.1.RELEASE</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>redis.clients</groupId>-->
<!-- <artifactId>jedis</artifactId>-->
<!-- <version>3.1.0</version>-->
<!-- </dependency>-->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
......
package com.pms.ocp.common.utils;
import lombok.Data;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author huxiuwu
* @version 1.0
* @date 2022/3/14 15:38
*/
@Data
public class PageUtil<T> {
/**
* 实体类列表
*/
List<T> content;
/**
* 是否首页
*/
boolean first;
/**
* 是否尾页
*/
boolean last;
/**
* 总记录数
*/
Integer totalElements;
/**
* 总页数
*/
Integer totalPages;
Integer numberOfElements;
/**
* 每页记录数
*/
Integer size;
/**
* 当前页
*/
Integer number;
public void pageUtil(Integer page, Integer size, List<T> list) {
List<T> list1 = list.stream().skip((page - 1) * size).limit(size).collect(Collectors.toList());
int length = list.size();
this.first = (page == 0);//是否第一页
this.last = (page == (length - 1) / size);//是否最后一页
this.totalPages = ((length - 1) / size + 1);//总页数
this.totalElements = (length);//总elements
this.size = (size);//每页多少elements
this.content = (list1);//内容
this.numberOfElements = (list1.size());//当前页elements
this.number = (page);//当前页数,第一页是0
}
}
package com.pms.ocp.controller;
import com.pms.ocp.model.dto.ApiBaseDto;
import com.pms.ocp.model.entity.OcpApiBase;
import com.pms.ocp.model.vo.OcpApiBaseVo;
import com.pms.ocp.model.vo.ResponseVO;
import com.pms.ocp.service.ApiDetailsService;
import io.swagger.annotations.Api;
......@@ -24,8 +26,8 @@ public class ApiDetailsController {
@ApiOperation("服务库服务详情-查询")
@GetMapping("/query")
public ResponseVO<OcpApiBase> getApiDetails(String code) {
return apiDetailsService.getApiDetails(code);
public ResponseVO<OcpApiBaseVo> getApiDetails(String apiCode) {
return apiDetailsService.getApiDetails(apiCode);
}
}
package com.pms.ocp.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pms.ocp.common.utils.ExcelUtils;
......@@ -8,9 +9,11 @@ import com.pms.ocp.model.dto.ModelSubscribeDTO;
import com.pms.ocp.model.dto.ModelPropertyDTO;
import com.pms.ocp.model.dto.ModelRelationDTO;
import com.pms.ocp.model.entity.Model;
import com.pms.ocp.model.entity.ModelProperty;
import com.pms.ocp.model.entity.ModelSubscribe;
import com.pms.ocp.model.entity.ModelAudit;
import com.pms.ocp.model.vo.ModelAuditVO;
import com.pms.ocp.model.vo.ModelPropertyVO;
import com.pms.ocp.model.vo.ResponseVO;
import com.pms.ocp.service.*;
import io.swagger.annotations.Api;
......@@ -53,16 +56,6 @@ public class ModelBaseController {
@Autowired
private ModelRelationService modelRelationService;
/**
* 模型分类-查询
*
* @return
*/
// @ApiOperation("模型分类-查询")
// @GetMapping("/get/model/type")
// public ResponseVO getModelType() {
// return modelGroupService.getModelType();
// }
/**
* 模型-增加
......@@ -77,16 +70,16 @@ public class ModelBaseController {
}
/**
* 模型-查询
* 模型-查询列表
*
* @return
*/
@ApiOperation("模型-查询")
@GetMapping("/get/model")
public ResponseVO getModel(@ApiParam(value = "模型订阅编号") @RequestParam(value = "objId", required = false) String objId,
@ApiParam(value = "模型编码") @RequestParam(value = "modelCode", required = false) String modelCode,
@ApiParam(value = "当前页") @RequestParam(value = "currentPage", required = false) Integer currentPage,
@ApiParam(value = "每页数量") @RequestParam(value = "pageSize", required = false) Integer pageSize) {
@ApiOperation("模型-查询列表")
@GetMapping("/get/model/list")
public ResponseVO getModelList(@ApiParam(value = "模型订阅编号") @RequestParam(value = "objId", required = false) String objId,
@ApiParam(value = "模型编码") @RequestParam(value = "modelCode", required = false) String modelCode,
@ApiParam(value = "当前页") @RequestParam(value = "currentPage", required = false) Integer currentPage,
@ApiParam(value = "每页数量") @RequestParam(value = "pageSize", required = false) Integer pageSize) {
PageHelper.startPage(currentPage, pageSize);
List<Model> modelList = modelService.getModelList(objId, modelCode);
......@@ -257,16 +250,28 @@ public class ModelBaseController {
}
/**
* 模型属性-查询
* 模型属性-查询列表
*
* @return
*/
@ApiOperation("模型属性-查询")
@GetMapping("get/model/property")
public ResponseVO getModelProperty(@ApiParam(value = "模型属性编号") @RequestParam(value = "objId", required = false) String objId,
@ApiParam(value = "模型编码") @RequestParam(value = "modelCode", required = false) String modelCode,
@ApiParam(value = "订阅公司编码") @RequestParam(value = "subsCompanyCode", required = false) String subsCompanyCode) {
return ResponseVO.ok(modelPropertyService.listModelProperty(objId, modelCode, subsCompanyCode));
@ApiOperation("模型属性-查询列表")
@GetMapping("get/model/property/list")
public ResponseVO getModelPropertyList(@ApiParam(value = "模型编码") @RequestParam(value = "modelCode", required = false) String modelCode,
@ApiParam(value = "模型所属类型编码") @RequestParam(value = "modelGroupCode", required = false) String modelGroupCode,
@ApiParam(value = "公司编码") @RequestParam(value = "ownerCompanyCode", required = false) String ownerCompanyCode,
@ApiParam(value = "当前页") @RequestParam(value = "currentPage", required = false) Integer currentPage,
@ApiParam(value = "每页数量") @RequestParam(value = "pageSize", required = false) Integer pageSize) {
// PageHelper.startPage(currentPage, pageSize);
// List<ModelProperty> modelPropertyVOList = modelPropertyService.listModelProperty(objId, modelCode, subsCompanyCode);
// PageInfo<ModelProperty> pageInfo = new PageInfo<>(modelPropertyVOList);
PageHelper.startPage(currentPage, pageSize);
List<ModelPropertyVO> pageInfo = modelPropertyService.listModelPropertyVO(currentPage, pageSize, modelCode, ownerCompanyCode, modelGroupCode);
PageInfo<ModelPropertyVO> pageInfo1 = new PageInfo<>(pageInfo);
return ResponseVO.ok(pageInfo1);
}
/**
......
......@@ -50,7 +50,7 @@ public class ModelClassifyController {
**/
@ApiOperation("右侧子类详情列表")
@GetMapping("/subclassDetailsList")
public ResponseVO<PageInfo<OcpModelGroupVO>> subclassDetailsList(@RequestParam int currentPage,
public ResponseVO subclassDetailsList(@RequestParam int currentPage,
@RequestParam int pageSize,
@RequestParam(required = false,defaultValue = "") String parentGroupCode,
@RequestParam(required = false,defaultValue = "") String subclassGroupName
......
......@@ -11,5 +11,5 @@ import java.util.List;
@Mapper
public interface ApiDetailsMapper extends BaseMapper<OcpApiBase> {
OcpApiBaseVo selectByCode(String code);
OcpApiBaseVo selectByCode(@Param("apiCode") String apiCode);
}
package com.pms.ocp.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pms.ocp.model.entity.Model;
import com.pms.ocp.model.entity.ModelProperty;
import com.pms.ocp.model.vo.ModelPropertyVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Auther: wangjian
......@@ -13,4 +16,9 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ModelPropertyMapper extends BaseMapper<ModelProperty> {
List<ModelPropertyVO> listModelPropertyVO(@Param("modelCode") String modelCode,
@Param("ownerCompanyCode") String ownerCompanyCode,
@Param("modelGroupCode") String modelGroupCode);
}
......@@ -57,21 +57,21 @@ public class ModelDTO {
*/
@Excel(name = "所属专业", replace = {"输电_ts", "变电_t", "直流_ds", "配电_ds", "技术_tc", "计划_pl", "综合_im"})
@ApiModelProperty(value = "所属专业 ts:输电,t:变电, dc:直流,ds:配电,tc:技术,pl:计划 im:综合")
private String professional_kind;
private String professionalKind;
/**
* 模型分类编码
*/
@Excel(name = "模型分类编码")
@ApiModelProperty(value = "模型分类编码")
private String model_group_code;
private String modelGroupCode;
/**
* 模型表名称
*/
@Excel(name = "模型表名称")
@ApiModelProperty(value = "模型表名称")
private String model_table;
private String modelTable;
/**
* 是否启用 0:未启用,1:启用
......
......@@ -30,6 +30,12 @@ public class ModelPropertyDTO {
@ApiModelProperty(value = "模型编号")
private String modelCode;
/**
* 模型名称
*/
@ApiModelProperty(value = "模型名称")
private String modelName;
/**
* 属性名称
*/
......@@ -79,10 +85,10 @@ public class ModelPropertyDTO {
private Integer boolRequired;
/**
* 推广类型 0:统推,1:自建
* 表名称
*/
// @ApiModelProperty(value = "推广类型 0:统推,1:自建")
// private String propPromotion;
// @ApiModelProperty(value = "表名称")
// private String modelTableName;
/**
* 显示顺序
......
......@@ -47,17 +47,17 @@ public class Model {
/**
* 所属专业ts:输电,t:变电, dc:直流,ds配电,tc:技术,pl计划 im综合
*/
private String professional_kind;
private String professionalKind;
/**
* 模型分类编码
*/
private String model_group_code;
private String modelGroupCode;
/**
* 模型表名称
*/
private String model_table;
private String modelTable;
/**
* 是否启用 0:未启用,1:启用
......
......@@ -26,7 +26,7 @@ public class OcpApiBase {
private String apiCode;
@ApiModelProperty("服务接口中文名称")
private String apiName;
private String apiName;
@ApiModelProperty("服务分类代码")
private String apiGroupCode;
......
......@@ -35,10 +35,12 @@ public class TreeNode implements Serializable {
private String companyCode;
@ApiModelProperty("子类")
private List<TreeNode> children;
private int belongLevel;
@ApiModelProperty("子类")
private int belongLevel;
private List<TreeNode> children;
public String getCode() {
return code == null ? "":code;
......
package com.pms.ocp.model.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
/**
* @Auther: wangjian
* @Date: 2022/2/22 16:40
* @Description:模型属性VO对象
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "模型属性VO对象")
public class ModelPropertyVO {
/**
* 模型属性编号
*/
@ApiModelProperty(value = "模型属性编号")
private String objId;
/**
* 模型编号
*/
@ApiModelProperty(value = "模型编号")
private String modelCode;
/**
* 模型表名称
*/
@ApiModelProperty(value = "模型表名称")
private String modelTableName;
/**
* 属性名称
*/
@ApiModelProperty(value = "属性名称")
private String columnName;
/**
* 属性编码
*/
@ApiModelProperty(value = "属性编码")
private String propCode;
/**
* 数据类型
*/
@ApiModelProperty(value = "数据类型")
private String dataType;
/**
* 数据长度
*/
@ApiModelProperty(value = "数据长度")
private Integer dataLength;
/**
* 数据精度
*/
@ApiModelProperty(value = "数据精度")
private Integer dataScale;
/**
* 是否主键
*/
@ApiModelProperty(value = "是否主键")
@TableField("is_pk")
private Integer boolPrimaryKey;
/**
* 显示顺序
*/
// private Integer propOrderNo;
/**
* 提交人id
*/
// private String propUserId;
/**
* 提交人姓名
*/
// private String propUserName;
/**
* 创建时间
*/
@ApiModelProperty(value = "模型关系编号")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime propCtime;
/**
* 修改时间
*/
@ApiModelProperty(value = "模型关系编号")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private LocalDateTime propMtime;
}
package com.pms.ocp.service;
import com.pms.ocp.model.dto.ApiBaseDto;
import com.pms.ocp.model.entity.OcpApiBase;
import com.pms.ocp.model.vo.OcpApiBaseVo;
import com.pms.ocp.model.vo.ResponseVO;
......@@ -12,10 +13,10 @@ import java.util.List;
public interface ApiDetailsService{
/**
*
* @param code
* @param apiCode
* @return
*/
ResponseVO getApiDetails(String code);
ResponseVO<OcpApiBaseVo> getApiDetails(String apiCode);
}
package com.pms.ocp.service;
import com.github.pagehelper.PageInfo;
import com.pms.ocp.model.dto.ModelPropertyDTO;
import com.pms.ocp.model.entity.ModelProperty;
import io.swagger.models.auth.In;
import com.pms.ocp.model.vo.ModelPropertyVO;
import java.util.List;
......@@ -53,6 +54,15 @@ public interface ModelPropertyService {
*/
List<ModelProperty> listModelProperty(String objId, String modelCode, String propCode);
/**
* 获取封装之后的模型属性列表
*
* @param
* @return
*/
List<ModelPropertyVO> listModelPropertyVO(Integer currentPage, Integer pageSize,
String modelCode, String ownerCompanyCode, String modelGroupCode);
/**
* 获取模型属性
*
......
......@@ -58,9 +58,10 @@ public interface ModelService {
/**
* 获取模型列表
*
* @param modelId
* @param objId
* @param modelCode
* @return
*/
Model getModel(String modelId);
Model getModel(String objId, String modelCode);
}
......@@ -2,6 +2,7 @@ package com.pms.ocp.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.pms.ocp.mapper.ApiDetailsMapper;
import com.pms.ocp.model.dto.ApiBaseDto;
import com.pms.ocp.model.entity.OcpApiBase;
import com.pms.ocp.model.entity.OcpApiExtent;
import com.pms.ocp.model.entity.OcpApiSubs;
......@@ -38,8 +39,8 @@ public class ApiDetailsServiceImpl implements ApiDetailsService {
@Override
public ResponseVO getApiDetails(String code) {
OcpApiBaseVo ocpApiBase = apiDetailsMapper.selectByCode(code);
public ResponseVO<OcpApiBaseVo> getApiDetails(String apiCode) {
OcpApiBaseVo ocpApiBase = apiDetailsMapper.selectByCode(apiCode);
return ResponseVO.ok(ocpApiBase);
}
......
......@@ -2,9 +2,8 @@ package com.pms.ocp.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pms.ocp.common.constants.CodeEnum;
import com.pms.ocp.common.utils.PageUtil;
import com.pms.ocp.mapper.ModelClassifyMapper;
import com.pms.ocp.model.entity.ModelClassify;
import com.pms.ocp.model.vo.OcpModelGroupVO;
......@@ -60,10 +59,10 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
* 的map.第二次是根据搜素框的值进行模糊查询
* @return pms.ocp.model.vo.ResponseVO
* @author huxiuwu
* @date 2022/3/9
* @date 2022/3/9 <PageInfo<OcpModelGroupVO>>
**/
@Override
public ResponseVO<PageInfo<OcpModelGroupVO>> subclassDetailsList(int currentPage,int pageSize,String parentGroupCode,String subclassGroupName) {
public ResponseVO subclassDetailsList(int currentPage,int pageSize,String parentGroupCode,String subclassGroupName) {
//查询所有
List<OcpModelGroupVO> ocpModelGroupVOList = this.selectByCondition(null,null);
//将查询到所有数据的list转换为key为分类code,value为本身的map
......@@ -71,14 +70,13 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
//根据key获取前端传入code的对象
OcpModelGroupVO ocpModelGroupVO = groupByCode.get(parentGroupCode);
//模糊查询
PageHelper.startPage(currentPage,pageSize);
List<OcpModelGroupVO> dimConditionList = this.selectByCondition(null,subclassGroupName);
//递归获取模糊查询后属于parentGroupCode子集
List<OcpModelGroupVO> childrenList = findChildren(dimConditionList, ocpModelGroupVO, new LinkedList<>());
PageInfo<OcpModelGroupVO> pageInfo = new PageInfo<>(childrenList);
return ResponseVO.ok(pageInfo);
PageUtil<OcpModelGroupVO> pageUtil = new PageUtil<>();
pageUtil.pageUtil(currentPage,pageSize,childrenList);
return ResponseVO.ok(pageUtil);
}
/**
* 修改
*
......@@ -117,25 +115,28 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
* 获取父节点下的所有子节点放入list中
* @author huxiuwu
* @date 2022/3/9
* @param groupList
* @param childList
* @param
* @param
* @param
* @return void
**/
private List<OcpModelGroupVO> findChildren(List<OcpModelGroupVO> groupList, OcpModelGroupVO parent,List<OcpModelGroupVO> childList) {
for (OcpModelGroupVO vo : groupList) {
//遍历出父id等于参数的id,add进子节点集合
if (parent!= null
&& parent.getModelGroupCode()
.equals(vo.getModelGroupPcode())) {
&& parent.getModelGroupCode()
.equals(vo.getModelGroupPcode())
&& !"".equals(parent.getModelGroupCode())) {
//递归遍历下一级
vo.setModelGroupPName(parent.getModelGroupName());
childList.add(vo);
childList = findChildren(groupList,vo,childList);
vo.setModelGroupPName(parent.getModelGroupName());
if (!childList.remove(vo)){
childList.add(vo);
}
findChildren(groupList, vo, childList);
}
}
return childList;
}
/**
* 构建树节点
* @author huxiuwu
......@@ -162,7 +163,6 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
//设置上级父类名称
node.setModelGroupPName(parent.getModelGroupName());
//说明他有父类其下子类都需要加一级
addLevel(node,treeNodes);
parent.getChildrenList().add(node);
continue;
}
......@@ -170,6 +170,7 @@ public class ModelClassifyServiceImpl implements ModelClassifyService {
}
return result;
}
/**
*
* @author huxiuwu
......
......@@ -2,19 +2,24 @@ package com.pms.ocp.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pms.ocp.mapper.ModelPropertyMapper;
import com.pms.ocp.model.dto.ModelPropertyDTO;
import com.pms.ocp.model.entity.Model;
import com.pms.ocp.model.entity.ModelProperty;
import com.pms.ocp.model.vo.ModelPropertyVO;
import com.pms.ocp.service.ModelPropertyService;
import io.swagger.models.auth.In;
import com.pms.ocp.service.ModelService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.Date;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Auther: wangjian
......@@ -28,6 +33,9 @@ public class ModelPropertyServiceImpl implements ModelPropertyService {
@Autowired
private ModelPropertyMapper modelPropertyMapper;
@Autowired
private ModelService modelService;
@Override
public Integer createModelProperty(ModelPropertyDTO modelPropertyDTO) {
......@@ -94,6 +102,35 @@ public class ModelPropertyServiceImpl implements ModelPropertyService {
return modelPropertyMapper.selectList(queryWrapper);
}
@Override
public List<ModelPropertyVO> listModelPropertyVO(Integer currentPage, Integer pageSize,
String modelCode, String ownerCompanyCode, String modelGroupCode) {
//// PageHelper.startPage(currentPage, pageSize);
//
// List<ModelProperty> modelPropertyList = listModelProperty(objId, modelCode, propCode);
//// List<ModelPropertyVO> modelPropertyVOList = modelPropertyService.listModelPropertyVO(objId, modelCode, subsCompanyCode);
// Model model = modelService.getModel(objId, modelCode);
//
// List<ModelPropertyVO> modelPropertyVOList = new ArrayList<>(modelPropertyList.size());
//
//// 组合模型与属性相关属性值
// if (model != null && !modelPropertyList.isEmpty()) {
// modelPropertyVOList = modelPropertyList.stream().map(modelProperty -> {
// ModelPropertyVO modelPropertyVO = new ModelPropertyVO();
// BeanUtils.copyProperties(modelProperty, modelPropertyVO);
//// modelPropertyVO.setModelTableName(model.getModelTable());
// return modelPropertyVO;
// }).collect(Collectors.toList());
// }
// PageInfo<ModelPropertyVO> pageInfo = new PageInfo<>(modelPropertyVOList);
return modelPropertyMapper.listModelPropertyVO(modelCode, ownerCompanyCode, modelGroupCode);
}
/**
* TODO
*
......
......@@ -154,9 +154,17 @@ public class ModelServiceImpl extends ServiceImpl<ModelMapper, Model> implements
* @return
*/
@Override
public Model getModel(String objId) {
public Model getModel(String objId, String modelCode) {
QueryWrapper<Model> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(Model::getObjId, objId);
if (StringUtils.isNotEmpty(objId)) {
queryWrapper.lambda().eq(Model::getObjId, objId);
}
if (StringUtils.isNotEmpty(modelCode)) {
queryWrapper.lambda().eq(Model::getModelCode, modelCode);
}
return modelMapper.selectOne(queryWrapper);
}
}
......@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pms.ocp.mapper.ApiDetailsMapper">
<select id="oneTenantGroup" resultType="com.pms.ocp.model.vo.OcpApiBaseVo">
<select id="selectByCode" resultType="com.pms.ocp.model.vo.OcpApiBaseVo">
select
oab.obj_id,oab.api_code,oae.api_code,oab.api_name,oae.cluster_name,
......@@ -10,8 +10,8 @@
LEFT JOIN ocp_api_extent oae
on oab.api_code = oae.api_code
where oab.is_delete = 0
<if test="code !=null and code!=''">
and oab.api_group_code = #{code}
<if test="apiCode!=null and apiCode!=''">
and oab.api_code = #{apiCode}
</if>
</select>
</mapper>
<?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.pms.ocp.mapper.ModelPropertyMapper">
<!--
collection:表示遍历的数组或者集合,填写对应 key 的值
item:集合中被遍历的元素名,自己随意起的名字
separator:每次遍历元素后用于拼接字符串
open:遍历开始拼接的字符串
close:遍历结束拼接字符串
index:遍历索引
例如本条 SQL 语句,拼接后的结果为:
insert into user(username, password) values (?, ?), (?, ?), ...
-->
<!-- <insert id="insertBatchModel" useGeneratedKeys="true" keyProperty="id">-->
<!-- insert into ocp_model_base(username, password)-->
<!-- values-->
<!-- <foreach collection="users" item="user" separator=",">-->
<!-- (#{user.username}, #{user.password})-->
<!-- </foreach>-->
<!-- </insert>-->
<resultMap type="com.pms.ocp.model.vo.ModelPropertyVO" id="mpMap">
<result property="objId" column="obj_id" jdbcType="VARCHAR"/>
<result property="columnName" column="column_name" jdbcType="VARCHAR"/>
<result property="dataLength" column="data_length" jdbcType="VARCHAR"/>
<result property="dataScale" column="data_scale" jdbcType="VARCHAR"/>
<result property="dataType" column="data_type" jdbcType="VARCHAR"/>
<result property="boolPrimaryKey" column="is_pk" jdbcType="VARCHAR"/>
<result property="modelCode" column="model_code" jdbcType="INTEGER"/>
<result property="propCode" column="prop_code" jdbcType="VARCHAR"/>
<result property="modelTableName" column="model_table" jdbcType="VARCHAR"/>
<result property="propCtime" column="prop_ctime" jdbcType="VARCHAR"/>
<result property="propMtime" column="prop_mtime" jdbcType="VARCHAR"/>
</resultMap>
<select id="listModelPropertyVO" resultMap="mpMap">
SELECT omp.obj_id, omp.data_length, omp.data_scale, omp.data_type, omp.is_pk, omp.column_name,
omp.prop_code, omp.prop_ctime, omp.prop_mtime,
omb.model_code, omb.model_name, omb.model_table
FROM ocp_model_prop omp
JOIN ocp_model_base omb on omp.model_code = omb.model_code
<where>
<if test="modelCode !=null and modelCode !='' ">
and omp.model_code = #{model_code}
</if>
<if test="ownerCompanyCode !=null and ownerCompanyCode !='' ">
and omb.owner_company_code = #{ownerCompanyCode}
</if>
<if test="modelGroupCode !=null and modelGroupCode !='' ">
and omb.model_group_code = #{modelGroupCode}
</if>
</where>
</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