Commit 8875e5a3 authored by zhaochengming's avatar zhaochengming

赵呈明 --应用服务树分类

parent b849f96b
......@@ -42,8 +42,8 @@ public class OcpApiTreeController {
@PostMapping("/instertree")
@ApiOperation("服务树分类--新增")
public ResponseVO inseter(@RequestBody OcpApiGroupDtos ocpApiGroupDtos){
boolean flag = service.insertTree(ocpApiGroupDtos);
public ResponseVO inseter(@RequestBody OcpApiGroup ocpApiGroup){
boolean flag = service.insertTree(ocpApiGroup);
if (flag){
return ResponseVO.ok();
}
......
......@@ -32,5 +32,8 @@ public interface OcpApiTreeMapper extends BaseMapper<OcpApiGroup> {
List<OcpApiGroup> selectThreeApiGroupsList(Long apiGroupPromotionType, String apiGroupCode);
List<OcpApiGroup> selectList(Long apiGroupPromotionType, String apiGroupCode,Long apiGroupLevel);
List<OcpApiGroup> selectLists(Long apiGroupPromotionType, String apiGroupCode,Long apiGroupLevel);
//code重复问题
List<OcpApiGroup> selectGroupCode();
}
......@@ -16,6 +16,7 @@ import java.util.List;
@TableName("ocp_api_group")
@ApiModel("服务分类表")
public class OcpApiGroup {
@TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty("主键ID")
private String objId;
......
......@@ -21,7 +21,7 @@ public interface OcpApiTreeService extends IService<OcpApiGroup> {
/**
* 新增服务分类
*/
boolean insertTree(OcpApiGroupDtos ocpApiGroupDtos);
boolean insertTree(OcpApiGroup ocpApiGroup);
/*
......
......@@ -62,30 +62,19 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr
/**
* 新增服务分类
*
* @param ocpApiGroupDtos
* @param
*/
@Override
public boolean insertTree(OcpApiGroupDtos ocpApiGroupDtos) {
public boolean insertTree(OcpApiGroup ocpApiGroup) {
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
String code = RandomStringUtils.getRandomString(6);
boolean flag = true;
List<OcpApiGroup> ocpApiGroups = mapper.selectList(null);
for (OcpApiGroup ocpApiGroup : ocpApiGroups) {
if (ocpApiGroup.getApiGroupCode().equals(ocpApiGroupDtos.getApiGroupCode())) {
flag = false;
break;
}
}
if (flag == true) {
OcpApiGroup ocpApiGroup1 = new OcpApiGroup();
ocpApiGroup1.setObjId("");
ocpApiGroup1.setApiGroupMtime(timestamp);
ocpApiGroup1.setApiGroupCtime(timestamp);
BeanUtils.copyProperties(ocpApiGroupDtos, ocpApiGroup1);
ocpApiGroup1.setApiGroupCode(code);
mapper.insert(ocpApiGroup1);
}
ocpApiGroup.setObjId("");
ocpApiGroup.setApiGroupMtime(timestamp);
ocpApiGroup.setApiGroupCtime(timestamp);
ocpApiGroup.setApiGroupPcode(ocpApiGroup.getApiGroupCode());
ocpApiGroup.setApiGroupCode(code);
mapper.insert(ocpApiGroup);
return flag;
}
......@@ -150,8 +139,11 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr
if (StringUtils.isBlank(pageGroupDto.getApiGroupCode())){
List<OcpApiGroup> ocpApiGroups = mapper.selectTwoApiGroups(pageGroupDto.getApiGroupPromotionType());
pageInfo.setRecords(ocpApiGroups);
LambdaQueryWrapper<OcpApiGroup> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.eq(OcpApiGroup::getApiGroupPromotionType,pageGroupDto.getApiGroupPromotionType());
mapper.selectPage(pageInfo,lambdaQueryWrapper);
}else if (!(StringUtils.isBlank(pageGroupDto.getApiGroupCode()))){
List<OcpApiGroup> ocpApiGroups = mapper.selectList(pageGroupDto.getApiGroupPromotionType(),pageGroupDto.getApiGroupCode(),pageGroupDto.getApiGroupLevel());
List<OcpApiGroup> ocpApiGroups = mapper.selectLists(pageGroupDto.getApiGroupPromotionType(),pageGroupDto.getApiGroupCode(),pageGroupDto.getApiGroupLevel());
LambdaQueryWrapper<OcpApiGroup> lwq = new LambdaQueryWrapper<>();
pageInfo.setRecords(ocpApiGroups);
mapper.selectPage(pageInfo, lwq);
......
......@@ -86,13 +86,10 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, OcpTenantGroup>
ocpTenantGroup.setTenantGroupVersion("1.0");
}
OcpTenantBase ocpTenantBase = new OcpTenantBase();
BeanUtils.copyProperties(tenanBaseDto,ocpTenantBase);
if ("null".equals(tenanBaseDto.getTenantGroupCode())){
group.setTenantGroupCode(randomString);
}
tenantMapper.insert(tenanBaseDto);
tenantBasicMapper.insert(ocpTenantBase);
return falg;
}
......
<?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.OcpApiTreeMapper">
<!-- 一级树-->
<!-- 一级树-->
<select id="selectApiGroups" resultType="com.pms.ocp.model.entity.OcpApiGroup">
SELECT * FROM (select *,ROW_NUMBER() over(partition by api_group_promotion_type) as rn from ocp_api_group) as u where u.rn= 1;
</select>
<!-- 级树-->
<!-- 级树-->
<select id="selectTwoApiGroups" resultType="com.pms.ocp.model.entity.OcpApiGroup">
SELECT * FROM ocp_api_group WHERE api_group_promotion_type = #{apiGroupPromotionType};
SELECT * FROM ocp_api_group WHERE api_group_promotion_type = #{apiGroupPromotionType} and api_group_level = '1';
</select>
<!--级-->
<!--级-->
<select id="selectThreeApiGroupsList" resultType="com.pms.ocp.model.entity.OcpApiGroup">
SELECT * FROM ocp_api_group WHERE api_group_promotion_type = #{apiGroupPromotionType} and api_group_pcode = #{apiGroupCode};
</select>
<!--服务树 -查询-->
<select id="selectLists" resultType="com.pms.ocp.model.entity.OcpApiGroup">
SELECT * FROM ocp_api_group WHERE api_group_promotion_type = #{apiGroupPromotionType} and api_group_pcode = #{apiGroupCode} and api_group_level = #{apiGroupLevel};
</select>
<!-- code值重复问题 -->
<select id="selectGroupCode" resultType="com.pms.ocp.model.entity.OcpApiGroup">
SELECT api_group_code FROM ocp_api_group;
</select>
</mapper>
\ No newline at end of file
......@@ -26,5 +26,51 @@
SELECT * FROM ocp_tenant_group WHERE tenant_group_company_code = #{tenantGroupCompanyCode} and tenant_group_level = '1' ;
</select>
<!-- 模糊查询-->
<select id="queryLike" resultType="com.pms.ocp.model.entity.OcpTenantGroup">
select * from ocp_tenant_group
<where>
<if test="keyword !=null and keyword != '' ">
and tenant_group_code like CONCAT('%', #{keyword}::text,'%')
</if>
<if test="keyword !=null and keyword != '' ">
and tenant_group_name like CONCAT('%', #{keyword}::text,'%')
</if>
<if test="keyword !=null and keyword != '' ">
and tenant_group_company_code like CONCAT('%', #{keyword}::text,'%')
</if>
<if test="keyword !=null and keyword != '' ">
and tenant_group_pcode like CONCAT('%', #{keyword}::text,'%')
</if>
<if test="keyword !=null and keyword != '' ">
and tenant_type like CONCAT('%', #{keyword}::text,'%')
</if>
<if test="keyword !=null and keyword != '' ">
and tenant_group_version like CONCAT('%', #{keyword}::text,'%')
</if>
<if test="keyword !=null and keyword != '' ">
and tenant_group_order_no like CONCAT('%', #{keyword}::text,'%')
</if>
<if test="keyword !=null and keyword != '' ">
and tenant_group_user_id like CONCAT('%', #{keyword}::text,'%')
</if>
<if test="keyword !=null and keyword != '' ">
and tenant_group_user_name like CONCAT('%', #{keyword}::text,'%')
</if>
<if test="keyword !=null and keyword != '' ">
and tenant_group_ctime like CONCAT('%', #{keyword}::text,'%')
</if>
<if test="keyword !=null and keyword != '' ">
and tenant_group_mtime like CONCAT('%', #{keyword}::text,'%')
</if>
<if test="keyword !=null and keyword != '' ">
and is_delete like CONCAT('%', #{keyword}::text,'%')
</if>
<if test="keyword !=null and keyword != '' ">
and tenant_group_level like CONCAT('%', #{keyword}::text,'%')
</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