Browse Source

分布式本地缓存

master
陈裕财 3 years ago
parent
commit
d91e042754
  1. 24
      xm-core/src/main/java/com/xm/core/ctrl/XmTestCaseController.java
  2. 10
      xm-core/src/main/java/com/xm/core/service/XmTestCaseService.java
  3. 9
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmMenuMapper.xml
  4. 15
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTestCaseMapper.xml
  5. 2
      xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTestPlanCaseMapper.xml

24
xm-core/src/main/java/com/xm/core/ctrl/XmTestCaseController.java

@ -84,6 +84,30 @@ public class XmTestCaseController {
return m;
}
@ApiOperation( value = "测试用例排行榜",notes=" ")
@ApiResponses({
@ApiResponse(code = 200,response=XmTestCase.class,message = "{tips:{isOk:true/false,msg:'成功/失败原因',tipscode:'错误码'},total:总记录数,data:[数据对象1,数据对象2,...]}")
})
@RequestMapping(value="/getXmTestCaseSort",method=RequestMethod.GET)
public Map<String,Object> getXmTestCaseSort( @ApiIgnore @RequestParam Map<String,Object> xmTestCase){
Map<String,Object> m = new HashMap<>();
Tips tips=new Tips("查询成功");
paramsInit(xmTestCase);
String groupBy= (String) xmTestCase.get("groupBy");
if("func_id".equals(groupBy) || "menu_id".equals(groupBy) || "cuserid".equals(groupBy)){
}else {
return failed("groupBy-0","分组参数错误");
}
List<Map<String,Object>> xmTestCaseList = xmTestCaseService.getXmTestCaseSort(xmTestCase); //列出XmTestCase列表
PageUtils.responePage(m, xmTestCaseList);
m.put("data",xmTestCaseList);
m.put("tips", tips);
return m;
}
public void paramsInit(Map<String,Object> xmTestCase){
Object ids=xmTestCase.get("ids");
Object menuIds=xmTestCase.get("menuIds");

10
xm-core/src/main/java/com/xm/core/service/XmTestCaseService.java

@ -3,6 +3,9 @@ package com.xm.core.service;
import com.mdp.core.service.BaseService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 父类已经支持增删改查操作,因此,即使本类什么也不写,也已经可以满足一般的增删改查操作了.<br>
* 组织 com.qqkj 顶级模块 xm 大模块 core 小模块 <br>
@ -10,8 +13,11 @@ import org.springframework.stereotype.Service;
***/
@Service("xm.core.xmTestCaseService")
public class XmTestCaseService extends BaseService {
/** 请在此类添加自定义函数 */
public List<Map<String, Object>> getXmTestCaseSort(Map<String, Object> xmTestCase) {
return super.selectList("getXmTestCaseSort",xmTestCase);
}
/** 请在此类添加自定义函数 */
}

9
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmMenuMapper.xml

@ -212,8 +212,13 @@
<select id="getXmMenuSort" parameterType="HashMap" resultType="HashMap">
select count(*) as value,${groupBy} as id,
max( <if test="groupBy=='proposer_id'">proposer_name</if>
<if test="groupBy=='mm_userid'">mm_username</if> ) as name from xm_menu res
max(
<if test="groupBy=='func_id'">func_name</if>
<if test="groupBy=='proposer_id'">proposer_name</if>
<if test="groupBy=='mm_userid'">mm_username</if>
<if test="groupBy=='product_id'">product_id</if>
<if test="groupBy=='iteration_id'">iteration_name</if>
) as name from xm_menu res
<where>
<include refid="whereForMap"></include>
<include refid="where"></include>

15
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTestCaseMapper.xml

@ -23,7 +23,7 @@
</foreach>
</if>
<if test="projectId !=null and projectId !=''"> and exists ( select 1 from xm_test_plan_case c where c.case_id=res.id and c.project_id=#{projectId} )</if>
<if test="(productId != null and productId !='') or (iterationId!=null and iterationId!='')"> and exists( select 1 from xm_menu m where m.menu_id =res.menu_id
<if test="(iterationId!=null and iterationId!='')"> and exists( select 1 from xm_menu m where m.menu_id =res.menu_id
<if test="productId != null and productId !=''" >and m.product_id=#{productId} </if>
<if test="iterationId != null and iterationId !=''" >and m.iteration_id=#{iterationId} </if>
)
@ -36,7 +36,18 @@
</if>
</sql>
<select id="getXmTestCaseSort" parameterType="HashMap" resultType="HashMap">
select count(*) as value,${groupBy} as id,
max( <if test="groupBy=='casedb_id'">casedb_name</if>
<if test="groupBy=='cuserid'">cusername</if>
<if test="groupBy=='func_id'">func_name</if>
<if test="groupBy=='menu_id'">menu_name</if> ) as name from xm_test_case res
<where>
<include refid="whereForMap"></include>
<include refid="where"></include>
</where>
group by ${groupBy}
</select>
<!--结束 自定义sql函数区域-->

2
xm-core/src/main/resources/mybatis/mapper/xm/core/dao/XmTestPlanCaseMapper.xml

@ -12,7 +12,7 @@
</foreach>
</if>
<if test="key != null and key !='' "> and c.case_name like concat('%',#{key},'%') </if>
<if test="caseStatus != null and caseStatus !='' "> and c.case_status = #{caseStatus} </if>
<if test="funcPidPathsLike!=null and funcPidPathsLike!=''">
and exists( select 1 from xm_func f where f.pid_paths like concat(#{funcPidPathsLike},'%') and c.func_id=f.id)
</if>

Loading…
Cancel
Save