Commit 8875e5a3 authored by zhaochengming's avatar zhaochengming

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

parent b849f96b
...@@ -42,8 +42,8 @@ public class OcpApiTreeController { ...@@ -42,8 +42,8 @@ public class OcpApiTreeController {
@PostMapping("/instertree") @PostMapping("/instertree")
@ApiOperation("服务树分类--新增") @ApiOperation("服务树分类--新增")
public ResponseVO inseter(@RequestBody OcpApiGroupDtos ocpApiGroupDtos){ public ResponseVO inseter(@RequestBody OcpApiGroup ocpApiGroup){
boolean flag = service.insertTree(ocpApiGroupDtos); boolean flag = service.insertTree(ocpApiGroup);
if (flag){ if (flag){
return ResponseVO.ok(); return ResponseVO.ok();
} }
......
...@@ -32,5 +32,8 @@ public interface OcpApiTreeMapper extends BaseMapper<OcpApiGroup> { ...@@ -32,5 +32,8 @@ public interface OcpApiTreeMapper extends BaseMapper<OcpApiGroup> {
List<OcpApiGroup> selectThreeApiGroupsList(Long apiGroupPromotionType, String apiGroupCode); 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; ...@@ -16,6 +16,7 @@ import java.util.List;
@TableName("ocp_api_group") @TableName("ocp_api_group")
@ApiModel("服务分类表") @ApiModel("服务分类表")
public class OcpApiGroup { public class OcpApiGroup {
@TableId(type = IdType.ASSIGN_ID) @TableId(type = IdType.ASSIGN_ID)
@ApiModelProperty("主键ID") @ApiModelProperty("主键ID")
private String objId; private String objId;
......
...@@ -21,7 +21,7 @@ public interface OcpApiTreeService extends IService<OcpApiGroup> { ...@@ -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 ...@@ -62,30 +62,19 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr
/** /**
* 新增服务分类 * 新增服务分类
* *
* @param ocpApiGroupDtos * @param
*/ */
@Override @Override
public boolean insertTree(OcpApiGroupDtos ocpApiGroupDtos) { public boolean insertTree(OcpApiGroup ocpApiGroup) {
Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Timestamp timestamp = new Timestamp(System.currentTimeMillis());
String code = RandomStringUtils.getRandomString(6); String code = RandomStringUtils.getRandomString(6);
boolean flag = true; boolean flag = true;
List<OcpApiGroup> ocpApiGroups = mapper.selectList(null); ocpApiGroup.setObjId("");
for (OcpApiGroup ocpApiGroup : ocpApiGroups) { ocpApiGroup.setApiGroupMtime(timestamp);
if (ocpApiGroup.getApiGroupCode().equals(ocpApiGroupDtos.getApiGroupCode())) { ocpApiGroup.setApiGroupCtime(timestamp);
flag = false; ocpApiGroup.setApiGroupPcode(ocpApiGroup.getApiGroupCode());
break; ocpApiGroup.setApiGroupCode(code);
} mapper.insert(ocpApiGroup);
}
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);
}
return flag; return flag;
} }
...@@ -150,8 +139,11 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr ...@@ -150,8 +139,11 @@ public class OcpApiTreeServiceImpl extends ServiceImpl<OcpApiTreeMapper,OcpApiGr
if (StringUtils.isBlank(pageGroupDto.getApiGroupCode())){ if (StringUtils.isBlank(pageGroupDto.getApiGroupCode())){
List<OcpApiGroup> ocpApiGroups = mapper.selectTwoApiGroups(pageGroupDto.getApiGroupPromotionType()); List<OcpApiGroup> ocpApiGroups = mapper.selectTwoApiGroups(pageGroupDto.getApiGroupPromotionType());
pageInfo.setRecords(ocpApiGroups); pageInfo.setRecords(ocpApiGroups);
LambdaQueryWrapper<OcpApiGroup> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.eq(OcpApiGroup::getApiGroupPromotionType,pageGroupDto.getApiGroupPromotionType());
mapper.selectPage(pageInfo,lambdaQueryWrapper);
}else if (!(StringUtils.isBlank(pageGroupDto.getApiGroupCode()))){ }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<>(); LambdaQueryWrapper<OcpApiGroup> lwq = new LambdaQueryWrapper<>();
pageInfo.setRecords(ocpApiGroups); pageInfo.setRecords(ocpApiGroups);
mapper.selectPage(pageInfo, lwq); mapper.selectPage(pageInfo, lwq);
......
...@@ -86,13 +86,10 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, OcpTenantGroup> ...@@ -86,13 +86,10 @@ public class TenantServiceImpl extends ServiceImpl<TenantMapper, OcpTenantGroup>
ocpTenantGroup.setTenantGroupVersion("1.0"); ocpTenantGroup.setTenantGroupVersion("1.0");
} }
OcpTenantBase ocpTenantBase = new OcpTenantBase();
BeanUtils.copyProperties(tenanBaseDto,ocpTenantBase);
if ("null".equals(tenanBaseDto.getTenantGroupCode())){ if ("null".equals(tenanBaseDto.getTenantGroupCode())){
group.setTenantGroupCode(randomString); group.setTenantGroupCode(randomString);
} }
tenantMapper.insert(tenanBaseDto); tenantMapper.insert(tenanBaseDto);
tenantBasicMapper.insert(ocpTenantBase);
return falg; return falg;
} }
......
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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"> <mapper namespace="com.pms.ocp.mapper.OcpApiTreeMapper">
<!-- 一级树--> <!-- 一级树-->
<select id="selectApiGroups" resultType="com.pms.ocp.model.entity.OcpApiGroup"> <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 * 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>
<!-- 级树--> <!-- 级树-->
<select id="selectTwoApiGroups" resultType="com.pms.ocp.model.entity.OcpApiGroup"> <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>
<!--级--> <!--级-->
<select id="selectThreeApiGroupsList" resultType="com.pms.ocp.model.entity.OcpApiGroup"> <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 * FROM ocp_api_group WHERE api_group_promotion_type = #{apiGroupPromotionType} and api_group_pcode = #{apiGroupCode};
</select> </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> </mapper>
\ No newline at end of file
...@@ -25,6 +25,52 @@ ...@@ -25,6 +25,52 @@
<select id="selectGroups" resultType="com.pms.ocp.model.entity.OcpTenantGroup"> <select id="selectGroups" resultType="com.pms.ocp.model.entity.OcpTenantGroup">
SELECT * FROM ocp_tenant_group WHERE tenant_group_company_code = #{tenantGroupCompanyCode} and tenant_group_level = '1' ; SELECT * FROM ocp_tenant_group WHERE tenant_group_company_code = #{tenantGroupCompanyCode} and tenant_group_level = '1' ;
</select> </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> </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