Commit 3d07a376 authored by 陈祥烨's avatar 陈祥烨

修订Tpl多项删除

parent 61db96f4
......@@ -64,6 +64,17 @@ public class ApiInfoResource {
return ResponseHelper.buildResponse(apiInfoService.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr删除多项
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@DeleteMapping(value = "/s/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除多项", notes = "根据sequenceNbr删除多项")
public ResponseModel<Boolean[]> deleteModelsBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr")String sequenceNbr){
return ResponseHelper.buildResponse(apiInfoService.deleteByIds(sequenceNbr));
}
/**
* 根据sequenceNbr查询
* @param sequenceNbr 主键
* @return
......
package com.yeejoin.amos.api.tool.controller;
import com.yeejoin.amos.api.tool.face.model.ApiInfoModel;
import com.yeejoin.amos.api.tool.face.model.ApiSourceModel;
import com.yeejoin.amos.api.tool.face.model.TplModel;
import com.yeejoin.amos.api.tool.face.service.ApiInfoService;
import com.yeejoin.amos.api.tool.face.service.ApiSourceService;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
......@@ -25,6 +28,8 @@ public class ApiSourceResource {
@Autowired
ApiSourceService apiSourceService;
@Autowired
ApiInfoService apiInfoService;
/**
* 新增
......@@ -63,6 +68,10 @@ public class ApiSourceResource {
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
List<ApiInfoModel> apiInfoModels = apiInfoService.queryForApiInfoListBySeq(apiSourceService.queryCodeById(sequenceNbr));
for (ApiInfoModel apiInfoModel:apiInfoModels){
apiInfoService.removeById(apiInfoModel.getSequenceNbr());
}
return ResponseHelper.buildResponse(apiSourceService.removeById(sequenceNbr));
}
......
......@@ -71,7 +71,7 @@ public class TplCateResource {
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除", notes = "根据sequenceNbr删除")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr) {
List<TplModel> tplModels = tplService.queryForTplList(sequenceNbr);
List<TplModel> tplModels = tplService.queryForTplListByCategorySeq(sequenceNbr);
for (TplModel tplModel:tplModels){
tplService.removeById(tplModel.getSequenceNbr());
}
......
......@@ -119,8 +119,8 @@ public class TplResource {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<TplModel>> selectForList(Long categorySeq){
return ResponseHelper.buildResponse(tplService.queryForTplList(categorySeq));
public ResponseModel<List<TplModel>> selectForList(){
return ResponseHelper.buildResponse(tplService.queryForTplList());
}
/**
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.api.tool.face.service;
import com.yeejoin.amos.api.tool.face.orm.entity.ApiInfo;
import com.yeejoin.amos.api.tool.face.orm.dao.ApiInfoMapper;
import com.yeejoin.amos.api.tool.face.model.ApiInfoModel;
import org.apache.commons.beanutils.ConvertUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -29,4 +30,23 @@ public class ApiInfoService extends BaseService<ApiInfoModel,ApiInfo,ApiInfoMapp
return this.queryForList("" , false);
}
/**
* 列表查询 示例
*/
public List<ApiInfoModel> queryForApiInfoListBySeq(String apiSource) {
return this.queryForList("" , false,apiSource);
}
/**
* 删除多个模板
*/
public Boolean[] deleteByIds(String sequenceNbr){
String[] arr = sequenceNbr.split(",");
Long[] seq = (Long[]) ConvertUtils.convert(arr, Long.class);
Boolean[] arr2 = new Boolean[arr.length];
for (int i = 0;i < arr.length;i++){
arr2[i] = this.removeById(seq[i]);
}
return arr2;
}
}
......@@ -30,9 +30,15 @@ public class TplService extends BaseService<TplModel, Tpl, TplMapper> {
/**
* 列表查询
*/
public List<TplModel> queryForTplList(Long categorySeq) {
public List<TplModel> queryForTplListByCategorySeq(Long categorySeq) {
return this.queryForList("" , false,categorySeq);
}
/**
* 列表查询
*/
public List<TplModel> queryForTplList() {
return this.queryForList("" , false);
}
/**
......
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