申购车功能,门户相关接口
This commit is contained in:
parent
db9a819aba
commit
c1cfa1781e
|
@ -1,6 +1,5 @@
|
||||||
package io.renren.common.controller;
|
package io.renren.common.controller;
|
||||||
|
|
||||||
|
|
||||||
import io.renren.common.utils.Result;
|
import io.renren.common.utils.Result;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
package io.renren.common.interceptor;
|
package io.renren.common.interceptor;
|
||||||
|
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.context.annotation.PropertySource;
|
import org.springframework.context.annotation.PropertySource;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Component
|
@Component
|
||||||
@PropertySource("classpath:/yaweisso.properties")
|
@PropertySource("classpath:/yaweisso.properties")
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.renren.modules.category.controller;
|
package io.renren.modules.category.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.renren.common.exception.ErrorCode;
|
import io.renren.common.exception.ErrorCode;
|
||||||
import io.renren.common.utils.MessageUtils;
|
import io.renren.common.utils.MessageUtils;
|
||||||
|
@ -14,8 +15,10 @@ import io.renren.modules.category.service.CategoryService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -55,12 +58,20 @@ public class CategoryController {
|
||||||
|
|
||||||
@PostMapping("/insert")
|
@PostMapping("/insert")
|
||||||
@ApiOperation("保存")
|
@ApiOperation("保存")
|
||||||
|
@Transactional(rollbackFor = RuntimeException.class)
|
||||||
public Object insert(@RequestBody CategoryDTO categoryDTO) {
|
public Object insert(@RequestBody CategoryDTO categoryDTO) {
|
||||||
//效验数据
|
//效验数据
|
||||||
ValidatorUtils.validateEntity(categoryDTO, AddGroup.class, DefaultGroup.class);
|
ValidatorUtils.validateEntity(categoryDTO, AddGroup.class, DefaultGroup.class);
|
||||||
categoryDTO.setDelFlag(0);
|
categoryDTO.setDelFlag(0);
|
||||||
categoryService.save(categoryDTO);
|
categoryService.save(categoryDTO);
|
||||||
|
//若为一级分类,增加文件夹
|
||||||
|
if (ObjectUtil.isNull(categoryDTO.getPid())) {
|
||||||
|
File file = new File("D:\\新建文件夹\\resource\\" + categoryDTO.getName());
|
||||||
|
file.mkdirs();
|
||||||
|
if (file.mkdirs()) {
|
||||||
|
throw new RuntimeException("创建文件夹失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
return new Result();
|
return new Result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,4 +98,5 @@ public class CategoryController {
|
||||||
return new Result<>().error(ErrorCode.INTERNAL_SERVER_ERROR, MessageUtils.getMessage(ErrorCode.INTERNAL_SERVER_ERROR));
|
return new Result<>().error(ErrorCode.INTERNAL_SERVER_ERROR, MessageUtils.getMessage(ErrorCode.INTERNAL_SERVER_ERROR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class CategoryServiceImpl extends CrudServiceImpl<CategoryDao, Category,
|
||||||
@Transactional
|
@Transactional
|
||||||
public void deleteByIds(JSONObject jsonObject) {
|
public void deleteByIds(JSONObject jsonObject) {
|
||||||
JSONArray jsonArray = jsonObject.getJSONArray("ids");
|
JSONArray jsonArray = jsonObject.getJSONArray("ids");
|
||||||
|
//TODO:删除为一级分类时,删除模板保存的文件夹?
|
||||||
List<Long> idList = jsonArray.toJavaList(Long.class);
|
List<Long> idList = jsonArray.toJavaList(Long.class);
|
||||||
categoryDao.deleteByIds(idList);
|
categoryDao.deleteByIds(idList);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package io.renren.modules.fileManager.controller;
|
||||||
|
|
||||||
|
import io.renren.modules.fileManager.service.FileManagerService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/fileManager")
|
||||||
|
@Api(tags = "文件管理")
|
||||||
|
public class FileManagerController {
|
||||||
|
|
||||||
|
//@Autowired
|
||||||
|
//private FileManagerService fileManagerService;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package io.renren.modules.fileManager.service.impl;
|
||||||
|
|
||||||
|
import io.renren.modules.fileManager.service.FileManagerService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author
|
||||||
|
* @date 2022/04/20
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FileManagerServiceImpl implements FileManagerService {
|
||||||
|
|
||||||
|
}
|
|
@ -18,6 +18,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,25 +58,29 @@ public class ResourceController {
|
||||||
|
|
||||||
@PostMapping("/pageWithAttrs")
|
@PostMapping("/pageWithAttrs")
|
||||||
@ApiOperation("分页查询资源信息2")
|
@ApiOperation("分页查询资源信息2")
|
||||||
//@ApiImplicitParams({
|
@LogOperation("分页查询资源信息2")
|
||||||
// @ApiImplicitParam(name = "name", value = "资源名称", paramType = "query", dataType="String") ,
|
|
||||||
// @ApiImplicitParam(name = "type", value = "资源类型", paramType = "query",required = true, dataType="String") ,
|
|
||||||
// @ApiImplicitParam(name = "infoList", value = "类型", paramType = "query", dataType="List")
|
|
||||||
//})
|
|
||||||
//@RequiresPermissions("resource:resource:page")
|
|
||||||
public Result pageWithAttrs(@RequestBody JSONObject jsonObject){
|
public Result pageWithAttrs(@RequestBody JSONObject jsonObject){
|
||||||
return new Result<>().ok(resourceService.pageWithAttrs(jsonObject));
|
return new Result<>().ok(resourceService.pageWithAttrs(jsonObject));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/select/{id}")
|
@GetMapping("/select/{id}")
|
||||||
@ApiOperation("查询资源详细信息")
|
@ApiOperation("查询资源详细信息")
|
||||||
|
@LogOperation("查询资源详细信息")
|
||||||
//@RequiresPermissions("resource:resource:info")
|
//@RequiresPermissions("resource:resource:info")
|
||||||
public Result<ResourceDTO> get(@PathVariable("id") Long id){
|
public Result<ResourceDTO> get(@PathVariable("id") Long id){
|
||||||
ResourceDTO data = resourceService.selectWithAttrs(id);
|
ResourceDTO data = resourceService.selectWithAttrs(id);
|
||||||
|
|
||||||
return new Result<ResourceDTO>().ok(data);
|
return new Result<ResourceDTO>().ok(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/selectTotal")
|
||||||
|
@ApiOperation("查询系统及本部门已汇聚能力")
|
||||||
|
@LogOperation("查询系统及本部门已汇聚能力")
|
||||||
|
public Result selectTotal(){
|
||||||
|
return new Result<>().ok(resourceService.selectTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/insert")
|
@PostMapping("/insert")
|
||||||
@ApiOperation("保存")
|
@ApiOperation("保存")
|
||||||
@LogOperation("保存")
|
@LogOperation("保存")
|
||||||
|
@ -112,6 +118,23 @@ public class ResourceController {
|
||||||
return new Result();
|
return new Result();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getDevelopmentFile")
|
||||||
|
@ApiOperation("获取开发指南")
|
||||||
|
@LogOperation("获取开发指南")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "type", value = "类型", paramType = "query",required = true, dataType="String") ,
|
||||||
|
@ApiImplicitParam(name = "resourceId", value = "能力ID", paramType = "query",required = false, dataType="Long") ,
|
||||||
|
})
|
||||||
|
public void getDevelopmentFile(@ApiIgnore HttpServletRequest request, @ApiIgnore HttpServletResponse response){
|
||||||
|
try {
|
||||||
|
resourceService.getDevelopmentFile(request, response);
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.err.println(e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
new Result<>().error(500,"文件获取失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*@GetMapping("export")
|
/*@GetMapping("export")
|
||||||
@ApiOperation("导出")
|
@ApiOperation("导出")
|
||||||
@LogOperation("导出")
|
@LogOperation("导出")
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 资源表
|
* 资源表
|
||||||
|
@ -19,5 +20,7 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
||||||
|
|
||||||
Integer deleteByIds(@Param("ids") List<Long> idList);
|
Integer deleteByIds(@Param("ids") List<Long> idList);
|
||||||
|
|
||||||
List<ResourceDTO> selectWithAttrs(@Param("dto") ResourceDTO resourceDTO, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);
|
List<ResourceDTO> selectWithAttrs(@Param("dto") ResourceDTO resourceDTO);
|
||||||
|
|
||||||
|
List<Map> selectTypeCount(Long deptId);
|
||||||
}
|
}
|
|
@ -30,6 +30,10 @@ public class ResourceDTO implements Serializable {
|
||||||
private String description;
|
private String description;
|
||||||
@ApiModelProperty(value = "链接URL")
|
@ApiModelProperty(value = "链接URL")
|
||||||
private String link;
|
private String link;
|
||||||
|
@ApiModelProperty(value = "所属部门")
|
||||||
|
private Long deptId;
|
||||||
|
@ApiModelProperty(value = "地区编码")
|
||||||
|
private Long districtId;
|
||||||
@ApiModelProperty(value = "图片保存地址")
|
@ApiModelProperty(value = "图片保存地址")
|
||||||
private String image;
|
private String image;
|
||||||
@ApiModelProperty(value = "数据量")
|
@ApiModelProperty(value = "数据量")
|
||||||
|
|
|
@ -39,6 +39,14 @@ public class ResourceEntity {
|
||||||
*/
|
*/
|
||||||
private String link;
|
private String link;
|
||||||
/**
|
/**
|
||||||
|
* 所属部门
|
||||||
|
*/
|
||||||
|
private Long deptId;
|
||||||
|
/**
|
||||||
|
* 地区编码
|
||||||
|
*/
|
||||||
|
private Long districtId;
|
||||||
|
/**
|
||||||
* 图片保存地址
|
* 图片保存地址
|
||||||
*/
|
*/
|
||||||
private String image;
|
private String image;
|
||||||
|
|
|
@ -6,6 +6,8 @@ import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
import io.renren.modules.resource.entity.AttrEntity;
|
import io.renren.modules.resource.entity.AttrEntity;
|
||||||
import io.renren.modules.resource.entity.ResourceEntity;
|
import io.renren.modules.resource.entity.ResourceEntity;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +26,12 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
|
||||||
|
|
||||||
ResourceDTO selectWithAttrs(Long id);
|
ResourceDTO selectWithAttrs(Long id);
|
||||||
|
|
||||||
List<ResourceDTO> pageWithAttrs(JSONObject jsonObject);
|
Object pageWithAttrs(JSONObject jsonObject);
|
||||||
|
|
||||||
List<AttrEntity> selectAttrsByResourceId(Long id);
|
List<AttrEntity> selectAttrsByResourceId(Long id);
|
||||||
|
|
||||||
|
Object selectTotal();
|
||||||
|
|
||||||
|
void getDevelopmentFile(HttpServletRequest request, HttpServletResponse response) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,10 +1,13 @@
|
||||||
package io.renren.modules.resource.service.impl;
|
package io.renren.modules.resource.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.renren.common.service.impl.CrudServiceImpl;
|
import io.renren.common.service.impl.CrudServiceImpl;
|
||||||
import io.renren.modules.resource.dao.AttrDao;
|
import io.renren.modules.resource.dao.AttrDao;
|
||||||
import io.renren.modules.resource.dao.ResourceDao;
|
import io.renren.modules.resource.dao.ResourceDao;
|
||||||
|
@ -12,12 +15,22 @@ import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
import io.renren.modules.resource.entity.AttrEntity;
|
import io.renren.modules.resource.entity.AttrEntity;
|
||||||
import io.renren.modules.resource.entity.ResourceEntity;
|
import io.renren.modules.resource.entity.ResourceEntity;
|
||||||
import io.renren.modules.resource.service.ResourceService;
|
import io.renren.modules.resource.service.ResourceService;
|
||||||
|
import io.renren.modules.security.user.SecurityUser;
|
||||||
|
import io.renren.modules.security.user.UserDetail;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -103,12 +116,46 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ResourceDTO> pageWithAttrs(JSONObject jsonObject) {
|
public Object pageWithAttrs(JSONObject jsonObject) {
|
||||||
ResourceDTO resourceDTO = JSON.toJavaObject(jsonObject, ResourceDTO.class);
|
ResourceDTO resourceDTO = JSON.toJavaObject(jsonObject, ResourceDTO.class);
|
||||||
|
|
||||||
Integer pageNum = jsonObject.getInteger("pageNum");
|
Integer pageNum = jsonObject.getInteger("pageNum");
|
||||||
Integer pageSize = jsonObject.getInteger("pageSize");
|
Integer pageSize = jsonObject.getInteger("pageSize");
|
||||||
return resourceDao.selectWithAttrs(resourceDTO, (pageNum - 1) * pageSize, pageSize);
|
Page<ResourceDTO> resultPage = new Page<>(pageNum, pageSize);
|
||||||
|
if (resourceDTO.getInfoList().isEmpty()) {
|
||||||
|
Page<ResourceEntity> page = new Page(pageNum, pageSize);
|
||||||
|
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("del_flag", 0)
|
||||||
|
.like(StringUtils.isNotBlank(resourceDTO.getName()), "name", resourceDTO.getName())
|
||||||
|
.eq(ObjectUtil.isNotNull(resourceDTO.getDistrictId()),"district_id", resourceDTO.getDistrictId())
|
||||||
|
.eq(ObjectUtil.isNotNull(resourceDTO.getDeptId()),"dept_id", resourceDTO.getDeptId())
|
||||||
|
.eq("type", resourceDTO.getType());
|
||||||
|
Page<ResourceEntity> entityPage = resourceDao.selectPage(page, queryWrapper);
|
||||||
|
ArrayList<ResourceDTO> list = new ArrayList<>();
|
||||||
|
entityPage.getRecords().forEach(item -> {
|
||||||
|
ResourceDTO dto = new ResourceDTO();
|
||||||
|
BeanUtils.copyProperties(item, dto);
|
||||||
|
dto.setInfoList(this.selectAttrsByResourceId(dto.getId()));
|
||||||
|
list.add(dto);
|
||||||
|
});
|
||||||
|
resultPage.setRecords(list);
|
||||||
|
resultPage.setTotal(page.getTotal());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO);
|
||||||
|
int j = pageNum * pageSize > resourceDTOS.size() ? resourceDTOS.size() : pageNum * pageSize;
|
||||||
|
if (resourceDTOS.isEmpty()) {
|
||||||
|
resultPage.setRecords(null);
|
||||||
|
resultPage.setTotal(0);
|
||||||
|
} else {
|
||||||
|
ArrayList<ResourceDTO> recordLists = new ArrayList<>();
|
||||||
|
for (int i = (pageNum - 1 ) * pageSize; i < j; i++) {
|
||||||
|
recordLists.add(resourceDTOS.get(i));
|
||||||
|
}
|
||||||
|
resultPage.setRecords(recordLists);
|
||||||
|
resultPage.setTotal(resourceDTOS.size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resultPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -119,4 +166,55 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
.orderByDesc("attr_type");
|
.orderByDesc("attr_type");
|
||||||
return attrDao.selectList(wrapper);
|
return attrDao.selectList(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object selectTotal() {
|
||||||
|
UserDetail user = SecurityUser.getUser();
|
||||||
|
HashMap<String, Object> resultMap = new HashMap<>();
|
||||||
|
List<Map> totalMap = resourceDao.selectTypeCount(null);
|
||||||
|
resultMap.put("total", totalMap);
|
||||||
|
List<Map> deptMap = resourceDao.selectTypeCount(user.getDeptId());
|
||||||
|
resultMap.put("dept", deptMap);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getDevelopmentFile(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||||
|
//String type = request.getParameter("type").toString();
|
||||||
|
//Long resourceId = Long.parseLong(request.getParameter("resourceId"));
|
||||||
|
//String url = type + "/devModelFile.txt";
|
||||||
|
String url = "renren-admin/src/main/resources/temp/devModelFile.md";
|
||||||
|
File file = new File(url);
|
||||||
|
if (!file.exists()) {
|
||||||
|
Exception e = new Exception("文件不存在");
|
||||||
|
e.printStackTrace();
|
||||||
|
throw e;//抛出文件不存在的
|
||||||
|
}
|
||||||
|
response.setContentType("text/html");
|
||||||
|
FileInputStream fis = null;
|
||||||
|
OutputStream outputStream = response.getOutputStream();
|
||||||
|
try {
|
||||||
|
fis = new FileInputStream(file);
|
||||||
|
//将读取流拷贝到输出流中
|
||||||
|
IOUtils.copy(fis, outputStream);
|
||||||
|
//清空缓存的读取流,保证数据完整性
|
||||||
|
response.flushBuffer();
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("解析失败!!!");
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new Exception("解析失败");
|
||||||
|
} finally {
|
||||||
|
if (fis != null) {
|
||||||
|
try {
|
||||||
|
fis.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (outputStream != null) {
|
||||||
|
outputStream.close();//输出流关闭
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.err.println("获取开发指南成功!!!");
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
package io.renren.modules.resourceCar.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import io.renren.common.annotation.LogOperation;
|
||||||
|
import io.renren.common.utils.Result;
|
||||||
|
import io.renren.common.validator.ValidatorUtils;
|
||||||
|
import io.renren.common.validator.group.AddGroup;
|
||||||
|
import io.renren.common.validator.group.DefaultGroup;
|
||||||
|
import io.renren.modules.resourceCar.dto.ResourceCarDTO;
|
||||||
|
import io.renren.modules.resourceCar.service.ResourceCarService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申购记录表
|
||||||
|
*
|
||||||
|
* @author dg
|
||||||
|
* @since 1.0 2022-04-16
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/resourcecar")
|
||||||
|
@Api(tags="申购记录表")
|
||||||
|
public class ResourceCarController {
|
||||||
|
@Autowired
|
||||||
|
private ResourceCarService resourceCarService;
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation("分页")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "pageNum", value = "当前页码,从1开始", paramType = "body", required = true, dataType="int") ,
|
||||||
|
@ApiImplicitParam(name = "pageSize", value = "每页显示记录数", paramType = "body",required = true, dataType="int") ,
|
||||||
|
@ApiImplicitParam(name = "type", value = "资源类型", paramType = "body", dataType="String"),
|
||||||
|
@ApiImplicitParam(name = "name", value = "资源名称", paramType = "body", dataType="String")
|
||||||
|
})
|
||||||
|
//@RequiresPermissions("resourceCar:resourcecar:page")
|
||||||
|
public Result<IPage<ResourceCarDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||||
|
return new Result<IPage<ResourceCarDTO>>().ok(resourceCarService.selectPage(params));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/total")
|
||||||
|
@ApiOperation("申购车总数")
|
||||||
|
public Result total(){
|
||||||
|
return new Result<>().ok(resourceCarService.total());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/select/{id}")
|
||||||
|
@ApiOperation("信息")
|
||||||
|
//@RequiresPermissions("resourceCar:resourcecar:info")
|
||||||
|
public Result<ResourceCarDTO> get(@PathVariable("id") Long id){
|
||||||
|
ResourceCarDTO data = resourceCarService.get(id);
|
||||||
|
return new Result<ResourceCarDTO>().ok(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/insert")
|
||||||
|
@ApiOperation("保存")
|
||||||
|
@LogOperation("保存")
|
||||||
|
//@RequiresPermissions("resourceCar:resourcecar:save")
|
||||||
|
public Result save(@RequestBody ResourceCarDTO dto){
|
||||||
|
//效验数据
|
||||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
||||||
|
resourceCarService.insertOrUpdate(dto);
|
||||||
|
return new Result();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@ApiOperation("删除")
|
||||||
|
@LogOperation("删除")
|
||||||
|
//@RequiresPermissions("resourceCar:resourcecar:delete")
|
||||||
|
public Result delete(@RequestBody JSONObject jsonObject){
|
||||||
|
resourceCarService.deleteByIds(jsonObject);
|
||||||
|
return new Result();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package io.renren.modules.resourceCar.dao;
|
||||||
|
|
||||||
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.resourceCar.dto.ResourceCarDTO;
|
||||||
|
import io.renren.modules.resourceCar.entity.ResourceCarEntity;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申购记录表
|
||||||
|
*
|
||||||
|
* @author dg
|
||||||
|
* @since 1.0 2022-04-16
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ResourceCarDao extends BaseDao<ResourceCarEntity> {
|
||||||
|
|
||||||
|
Integer deleteByIds(@Param("ids") List<Long> ids);
|
||||||
|
|
||||||
|
List<ResourceCarDTO> selectPageWithResource(@Param("params") Map<String, Object> params,
|
||||||
|
@Param("pageNum") Integer pageNum,
|
||||||
|
@Param("pageSize") Integer pageSize);
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package io.renren.modules.resourceCar.dto;
|
||||||
|
|
||||||
|
import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申购记录表
|
||||||
|
*
|
||||||
|
* @author dg
|
||||||
|
* @since 1.0 2022-04-16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "申购记录表")
|
||||||
|
public class ResourceCarDTO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
@ApiModelProperty(value = "用户ID,sys_user主键")
|
||||||
|
private Long userId;
|
||||||
|
@ApiModelProperty(value = "资源ID,tb_data_resource主键")
|
||||||
|
private Long resourceId;
|
||||||
|
@ApiModelProperty(value = "删除标志:0:正常;1:已删除;9:其他")
|
||||||
|
private Integer delFlag;
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createDate;
|
||||||
|
@ApiModelProperty(value = "创建人")
|
||||||
|
private Long creator;
|
||||||
|
@ApiModelProperty(value = "修改时间")
|
||||||
|
private Date updateDate;
|
||||||
|
@ApiModelProperty(value = "修改人")
|
||||||
|
private Long updater;
|
||||||
|
@ApiModelProperty(value = "备用字段")
|
||||||
|
private String note1;
|
||||||
|
@ApiModelProperty(value = "备用字段")
|
||||||
|
private String note2;
|
||||||
|
@ApiModelProperty(value = "备用字段")
|
||||||
|
private String note3;
|
||||||
|
@ApiModelProperty(value = "备用字段")
|
||||||
|
private String note4;
|
||||||
|
@ApiModelProperty(value = "备用字段")
|
||||||
|
private String note5;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "资源信息")
|
||||||
|
private ResourceDTO resourceDTO;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package io.renren.modules.resourceCar.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申购记录表
|
||||||
|
*
|
||||||
|
* @author dg
|
||||||
|
* @since 1.0 2022-04-16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper=false)
|
||||||
|
@TableName("tb_resource_car")
|
||||||
|
public class ResourceCarEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户ID,sys_user主键
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 资源ID,tb_data_resource主键
|
||||||
|
*/
|
||||||
|
private Long resourceId;
|
||||||
|
/**
|
||||||
|
* 删除标志:0:正常;1:已删除;9:其他
|
||||||
|
*/
|
||||||
|
private Integer delFlag;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Date createDate;
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private Long creator;
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Date updateDate;
|
||||||
|
/**
|
||||||
|
* 修改人
|
||||||
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private Long updater;
|
||||||
|
/**
|
||||||
|
* 备用字段
|
||||||
|
*/
|
||||||
|
private String note1;
|
||||||
|
/**
|
||||||
|
* 备用字段
|
||||||
|
*/
|
||||||
|
private String note2;
|
||||||
|
/**
|
||||||
|
* 备用字段
|
||||||
|
*/
|
||||||
|
private String note3;
|
||||||
|
/**
|
||||||
|
* 备用字段
|
||||||
|
*/
|
||||||
|
private String note4;
|
||||||
|
/**
|
||||||
|
* 备用字段
|
||||||
|
*/
|
||||||
|
private String note5;
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
package io.renren.modules.resourceCar.excel;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
|
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
|
||||||
|
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
|
||||||
|
import lombok.Data;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申购记录表
|
||||||
|
*
|
||||||
|
* @author dg
|
||||||
|
* @since 1.0 2022-04-16
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ContentRowHeight(20)
|
||||||
|
@HeadRowHeight(20)
|
||||||
|
@ColumnWidth(25)
|
||||||
|
public class ResourceCarExcel {
|
||||||
|
@ExcelProperty(value = "Long", index = 0)
|
||||||
|
private Long id;
|
||||||
|
@ExcelProperty(value = "用户ID,sys_user主键", index = 1)
|
||||||
|
private Long userId;
|
||||||
|
@ExcelProperty(value = "资源ID,tb_data_resource主键", index = 2)
|
||||||
|
private Long resourceId;
|
||||||
|
@ExcelProperty(value = "删除标志:0:正常;1:已删除;9:其他", index = 3)
|
||||||
|
private Integer delFlag;
|
||||||
|
@ExcelProperty(value = "创建时间", index = 4)
|
||||||
|
private Date createDate;
|
||||||
|
@ExcelProperty(value = "创建人", index = 5)
|
||||||
|
private Long creator;
|
||||||
|
@ExcelProperty(value = "修改时间", index = 6)
|
||||||
|
private Date updateDate;
|
||||||
|
@ExcelProperty(value = "修改人", index = 7)
|
||||||
|
private Long updater;
|
||||||
|
@ExcelProperty(value = "备用字段", index = 8)
|
||||||
|
private String note1;
|
||||||
|
@ExcelProperty(value = "备用字段", index = 9)
|
||||||
|
private String note2;
|
||||||
|
@ExcelProperty(value = "备用字段", index = 10)
|
||||||
|
private String note3;
|
||||||
|
@ExcelProperty(value = "备用字段", index = 11)
|
||||||
|
private String note4;
|
||||||
|
@ExcelProperty(value = "备用字段", index = 12)
|
||||||
|
private String note5;
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package io.renren.modules.resourceCar.service;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import io.renren.common.service.CrudService;
|
||||||
|
import io.renren.modules.resourceCar.dto.ResourceCarDTO;
|
||||||
|
import io.renren.modules.resourceCar.entity.ResourceCarEntity;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申购记录表
|
||||||
|
*
|
||||||
|
* @author dg
|
||||||
|
* @since 1.0 2022-04-16
|
||||||
|
*/
|
||||||
|
public interface ResourceCarService extends CrudService<ResourceCarEntity, ResourceCarDTO> {
|
||||||
|
|
||||||
|
void deleteByIds(JSONObject jsonObject);
|
||||||
|
|
||||||
|
void insertOrUpdate(ResourceCarDTO dto);
|
||||||
|
|
||||||
|
IPage<ResourceCarDTO> selectPage(Map<String, Object> params);
|
||||||
|
|
||||||
|
Object total();
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
package io.renren.modules.resourceCar.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import io.renren.common.service.impl.CrudServiceImpl;
|
||||||
|
import io.renren.modules.resource.dao.ResourceDao;
|
||||||
|
import io.renren.modules.resource.entity.ResourceEntity;
|
||||||
|
import io.renren.modules.resource.service.ResourceService;
|
||||||
|
import io.renren.modules.resourceCar.dao.ResourceCarDao;
|
||||||
|
import io.renren.modules.resourceCar.dto.ResourceCarDTO;
|
||||||
|
import io.renren.modules.resourceCar.entity.ResourceCarEntity;
|
||||||
|
import io.renren.modules.resourceCar.service.ResourceCarService;
|
||||||
|
import io.renren.modules.security.user.SecurityUser;
|
||||||
|
import io.renren.modules.security.user.UserDetail;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申购记录表
|
||||||
|
*
|
||||||
|
* @author dg
|
||||||
|
* @since 1.0 2022-04-16
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ResourceCarServiceImpl extends CrudServiceImpl<ResourceCarDao, ResourceCarEntity, ResourceCarDTO> implements ResourceCarService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ResourceService resourceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ResourceCarDao resourceCarDao;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ResourceDao resourceDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public QueryWrapper<ResourceCarEntity> getWrapper(Map<String, Object> params){
|
||||||
|
QueryWrapper<ResourceCarEntity> wrapper = new QueryWrapper<>();
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteByIds(JSONObject jsonObject) {
|
||||||
|
List<Long> ids = jsonObject.getJSONArray("ids").toJavaList(Long.class);
|
||||||
|
resourceCarDao.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertOrUpdate(ResourceCarDTO dto) {
|
||||||
|
Map<String, Object> selectMap = new HashMap<>();
|
||||||
|
UserDetail user = SecurityUser.getUser();
|
||||||
|
Long userId = user.getId();
|
||||||
|
selectMap.put("resource_id", dto.getResourceId());
|
||||||
|
selectMap.put("user_id", userId);
|
||||||
|
selectMap.put("del_flag", 0);
|
||||||
|
List<ResourceCarEntity> carEntities = resourceCarDao.selectByMap(selectMap);
|
||||||
|
if (carEntities.isEmpty()) {
|
||||||
|
ResourceCarEntity carEntity = new ResourceCarEntity();
|
||||||
|
dto.setUserId(userId);
|
||||||
|
BeanUtils.copyProperties(dto, carEntity);
|
||||||
|
resourceCarDao.insert(carEntity);
|
||||||
|
}else {
|
||||||
|
ResourceCarEntity entity = carEntities.get(0);
|
||||||
|
ResourceCarEntity carEntity = new ResourceCarEntity();
|
||||||
|
BeanUtils.copyProperties(entity, carEntity, "updateDate");
|
||||||
|
resourceCarDao.updateById(carEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<ResourceCarDTO> selectPage(Map<String, Object> params) {
|
||||||
|
UserDetail user = SecurityUser.getUser();
|
||||||
|
int pageNum = Integer.parseInt(params.get("pageNum").toString());
|
||||||
|
int pageSize = Integer.parseInt(params.get("pageSize").toString());
|
||||||
|
Page<ResourceCarDTO> page = new Page(pageNum, pageSize);
|
||||||
|
params.put("userId", user.getId());
|
||||||
|
List<ResourceCarDTO> resourceCarDTOS = resourceCarDao.selectPageWithResource(params, (pageNum - 1) * pageSize, pageSize);
|
||||||
|
resourceCarDTOS.forEach(item -> {
|
||||||
|
item.setResourceDTO(resourceService.selectWithAttrs(item.getResourceId()));
|
||||||
|
});
|
||||||
|
List<ResourceCarDTO> resourceCarDTOSs = resourceCarDao.selectPageWithResource(params, 0, 100000);
|
||||||
|
page.setRecords(resourceCarDTOS);
|
||||||
|
page.setTotal(resourceCarDTOSs.size());
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object total() {
|
||||||
|
UserDetail user = SecurityUser.getUser();
|
||||||
|
QueryWrapper<ResourceCarEntity> wrapper = new QueryWrapper<>();
|
||||||
|
wrapper.eq("del_flag", 0)
|
||||||
|
.eq("user_id", user.getId());
|
||||||
|
Integer count = resourceCarDao.selectCount(wrapper);
|
||||||
|
HashMap<String, Object> resultMap = new HashMap<>();
|
||||||
|
resultMap.put("count", count);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,7 +22,7 @@ import java.io.IOException;
|
||||||
* oauth2过滤器
|
* oauth2过滤器
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Oauth2Filter extends AuthenticatingFilter {
|
public class Oauth2Filter extends AuthenticatingFilter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception {
|
protected AuthenticationToken createToken(ServletRequest request, ServletResponse response) throws Exception {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -40,7 +41,7 @@ public class SysRegionController {
|
||||||
@ApiImplicitParam(name = "pid", value = "上级ID", paramType = "query", dataType="String")
|
@ApiImplicitParam(name = "pid", value = "上级ID", paramType = "query", dataType="String")
|
||||||
})
|
})
|
||||||
// @RequiresPermissions("sys:region:list")
|
// @RequiresPermissions("sys:region:list")
|
||||||
public Result<List<SysRegionDTO>> list(@RequestParam Map<String, Object> params){
|
public Result<List<SysRegionDTO>> list(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||||
List<SysRegionDTO> list = sysRegionService.list(params);
|
List<SysRegionDTO> list = sysRegionService.list(params);
|
||||||
|
|
||||||
return new Result<List<SysRegionDTO>>().ok(list);
|
return new Result<List<SysRegionDTO>>().ok(list);
|
||||||
|
@ -89,13 +90,13 @@ public class SysRegionController {
|
||||||
return new Result();
|
return new Result();
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping("{id}")
|
@PostMapping("{id}")
|
||||||
@ApiOperation("删除")
|
@ApiOperation("删除")
|
||||||
@LogOperation("删除")
|
@LogOperation("删除")
|
||||||
// @RequiresPermissions("sys:region:delete")
|
// @RequiresPermissions("sys:region:delete")
|
||||||
public Result delete(@PathVariable("id") Long id){
|
public Result delete(@PathVariable("id") Long id){
|
||||||
//效验数据
|
////效验数据
|
||||||
AssertUtils.isNull(id, "id");
|
//AssertUtils.isNull(id, "id");
|
||||||
|
|
||||||
int count = sysRegionService.getCountByPid(id);
|
int count = sysRegionService.getCountByPid(id);
|
||||||
if(count > 0){
|
if(count > 0){
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class SysRegionServiceImpl extends BaseServiceImpl<SysRegionDao, SysRegio
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getTreeList() {
|
public List<Map<String, Object>> getTreeList() {
|
||||||
|
|
||||||
return baseDao.getTreeList();
|
return baseDao.getTreeList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ spring:
|
||||||
druid:
|
druid:
|
||||||
#MySQL
|
#MySQL
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://localhost:3306/security_enterprise?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
url: jdbc:mysql://15.72.183.91:3306/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
|
||||||
username: renren
|
username: root
|
||||||
password: 123456
|
password: w@CmM1mBVQkPhdrc
|
||||||
initial-size: 10
|
initial-size: 10
|
||||||
max-active: 100
|
max-active: 100
|
||||||
min-idle: 10
|
min-idle: 10
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
<result property="name" column="name"/>
|
<result property="name" column="name"/>
|
||||||
<result property="description" column="description"/>
|
<result property="description" column="description"/>
|
||||||
<result property="link" column="link"/>
|
<result property="link" column="link"/>
|
||||||
|
<result property="deptId" column="dept_id"/>
|
||||||
|
<result property="districtId" column="district_id"/>
|
||||||
<result property="image" column="image"/>
|
<result property="image" column="image"/>
|
||||||
<result property="dataVolume" column="data_volume"/>
|
<result property="dataVolume" column="data_volume"/>
|
||||||
<result property="visits" column="visits"/>
|
<result property="visits" column="visits"/>
|
||||||
|
@ -32,6 +34,8 @@
|
||||||
<result property="name" column="name"/>
|
<result property="name" column="name"/>
|
||||||
<result property="description" column="description"/>
|
<result property="description" column="description"/>
|
||||||
<result property="link" column="link"/>
|
<result property="link" column="link"/>
|
||||||
|
<result property="deptId" column="dept_id"/>
|
||||||
|
<result property="districtId" column="district_id"/>
|
||||||
<result property="image" column="image"/>
|
<result property="image" column="image"/>
|
||||||
<result property="dataVolume" column="data_volume"/>
|
<result property="dataVolume" column="data_volume"/>
|
||||||
<result property="visits" column="visits"/>
|
<result property="visits" column="visits"/>
|
||||||
|
@ -84,36 +88,48 @@
|
||||||
tb_data_resource r,
|
tb_data_resource r,
|
||||||
tb_data_attr a
|
tb_data_attr a
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
and r.id = a.data_resource_id
|
AND r.id = a.data_resource_id
|
||||||
and r.type = #{dto.type}
|
AND r.type = #{dto.type}
|
||||||
and r.del_flag = 0
|
AND r.del_flag = 0
|
||||||
<if test="dto.name != null and dto.name != ''" >
|
<if test="dto.name != null and dto.name != ''" >
|
||||||
and r.name like CONCAT('%',#{dto.name},'%')
|
AND r.name like CONCAT('%',#{dto.name},'%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="dto.districtId != null and dto.districtId != ''" >
|
||||||
|
AND r.district_id = #{dto.districtId}
|
||||||
|
</if>
|
||||||
|
<if test="dto.deptId != null and dto.deptId != ''" >
|
||||||
|
AND r.dept_id = #{deptId}
|
||||||
|
</if>
|
||||||
<if test="dto.infoList.size > 0">
|
<if test="dto.infoList.size > 0">
|
||||||
AND
|
AND
|
||||||
a.data_resource_id IN (
|
a.data_resource_id IN (
|
||||||
SELECT
|
SELECT data_resource_id
|
||||||
data_resource_id
|
FROM (
|
||||||
FROM
|
SELECT tb.data_resource_id
|
||||||
(
|
FROM (
|
||||||
SELECT
|
<foreach collection="dto.infoList" item="item" separator="union all">
|
||||||
tb.data_resource_id
|
SELECT data_resource_id FROM tb_data_attr
|
||||||
FROM
|
WHERE attr_type = #{item.attrType}
|
||||||
(
|
AND attr_value = #{item.attrValue}
|
||||||
<foreach collection="dto.infoList" item="item" separator="union all">
|
AND del_flag = 0
|
||||||
SELECT data_resource_id FROM tb_data_attr
|
</foreach>) tb
|
||||||
WHERE attr_type = #{item.attrType} AND attr_value = #{item.attrValue} and del_flag = 0
|
GROUP BY tb.data_resource_id
|
||||||
</foreach>
|
HAVING COUNT( tb.data_resource_id ) = ${dto.infoList.size}
|
||||||
) tb
|
ORDER BY tb.data_resource_id ASC
|
||||||
GROUP BY
|
) tmp
|
||||||
tb.data_resource_id
|
)
|
||||||
HAVING
|
|
||||||
COUNT( tb.data_resource_id ) = ${dto.infoList.size}
|
|
||||||
ORDER BY
|
|
||||||
tb.data_resource_id ASC
|
|
||||||
) tmp) limit ${pageNum}, ${pageSize}
|
|
||||||
</if>
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTypeCount" resultType="java.util.Map">
|
||||||
|
select type, count(id)
|
||||||
|
from tb_data_resource
|
||||||
|
where 1 = 1
|
||||||
|
and del_flag = 0
|
||||||
|
<if test="deptId != null and deptId != ''">
|
||||||
|
and dept_id = #{deptId}
|
||||||
|
</if>
|
||||||
|
group by type
|
||||||
|
order by type
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?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="io.renren.modules.resourceCar.dao.ResourceCarDao">
|
||||||
|
|
||||||
|
<resultMap type="io.renren.modules.resourceCar.entity.ResourceCarEntity" id="resourceCarMap">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="resourceId" column="resource_id"/>
|
||||||
|
<result property="delFlag" column="del_flag"/>
|
||||||
|
<result property="createDate" column="create_date"/>
|
||||||
|
<result property="creator" column="creator"/>
|
||||||
|
<result property="updateDate" column="update_date"/>
|
||||||
|
<result property="updater" column="updater"/>
|
||||||
|
<result property="note1" column="note1"/>
|
||||||
|
<result property="note2" column="note2"/>
|
||||||
|
<result property="note3" column="note3"/>
|
||||||
|
<result property="note4" column="note4"/>
|
||||||
|
<result property="note5" column="note5"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<update id="deleteByIds">
|
||||||
|
update tb_resource_car
|
||||||
|
set del_flag = 1 ,
|
||||||
|
update_date = now()
|
||||||
|
where 1 = 1
|
||||||
|
and id in
|
||||||
|
<foreach collection="ids" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="selectPageWithResource" resultType="io.renren.modules.resourceCar.dto.ResourceCarDTO">
|
||||||
|
select trc.*
|
||||||
|
from tb_resource_car trc
|
||||||
|
<if test="(params.type != null and params.type != '') or (params.name != null and params.name != '')">
|
||||||
|
left join tb_data_resource tdr on trc.resource_id = tdr.id and tdr.del_flag = 0
|
||||||
|
</if>
|
||||||
|
where 1 = 1
|
||||||
|
and trc.del_flag = 0
|
||||||
|
and user_id = #{params.userId}
|
||||||
|
<if test="params.name != null and params.name != ''" >
|
||||||
|
and tdr.name like CONCAT('%',#{params.name},'%')
|
||||||
|
</if>
|
||||||
|
<if test="params.type != null and params.type != ''">
|
||||||
|
and tdr.type = #{params.type}
|
||||||
|
</if>
|
||||||
|
order by trc.update_date desc, trc.create_date desc
|
||||||
|
limit ${pageNum}, ${pageSize}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue