Merge branch 'master' into docker_package
This commit is contained in:
commit
6b5a55881c
|
@ -1,5 +1,7 @@
|
||||||
package io.renren.modules.fuse.controller;
|
package io.renren.modules.fuse.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import io.renren.common.annotation.LogOperation;
|
import io.renren.common.annotation.LogOperation;
|
||||||
import io.renren.common.constant.Constant;
|
import io.renren.common.constant.Constant;
|
||||||
import io.renren.common.page.PageData;
|
import io.renren.common.page.PageData;
|
||||||
|
@ -18,6 +20,7 @@ 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 java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,7 +32,7 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("fuse")
|
@RequestMapping("fuse")
|
||||||
@Api(tags="融合服务")
|
@Api(tags = "融合服务")
|
||||||
public class FuseController {
|
public class FuseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -38,35 +41,36 @@ public class FuseController {
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@ApiOperation("分页")
|
@ApiOperation("分页")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType="int") ,
|
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType = "int"),
|
||||||
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
|
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
|
||||||
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType="String") ,
|
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段,可选值(create_date、update_date、collectCount)", required = true, paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType="String"),
|
@ApiImplicitParam(name = Constant.ORDER, required = true, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = "name", value = "融合服务名称", paramType = "query", dataType="String"),
|
@ApiImplicitParam(name = "name", value = "融合服务名称", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = "description", value = "融合服务描述", paramType = "query", dataType="String"),
|
@ApiImplicitParam(name = "description", value = "融合服务描述", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = "applicationArea", value = "应用领域", paramType = "query", dataType="String"),
|
@ApiImplicitParam(name = "applicationArea", value = "应用领域", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType="int"),
|
@ApiImplicitParam(name = "deptId", value = "所属部门", paramType = "query", dataType = "int"),
|
||||||
@ApiImplicitParam(name = "deptUser", value = "部门联系人", paramType = "query", dataType="String"),
|
@ApiImplicitParam(name = "deptUser", value = "部门联系人", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = "mobile", value = "部门联系人电话", paramType = "query", dataType="String"),
|
@ApiImplicitParam(name = "mobile", value = "部门联系人电话", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = "provider", value = "服务商", paramType = "query", dataType="String"),
|
@ApiImplicitParam(name = "provider", value = "服务商", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = "providerUser", value = "服务商联系人", paramType = "query", dataType="String"),
|
@ApiImplicitParam(name = "providerUser", value = "服务商联系人", paramType = "query", dataType = "String"),
|
||||||
@ApiImplicitParam(name = "providerMobile", value = "服务商联系人电话", paramType = "query", dataType="String")
|
@ApiImplicitParam(name = "providerMobile", value = "服务商联系人电话", paramType = "query", dataType = "String")
|
||||||
})
|
})
|
||||||
public Result<PageData<TbFuseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
|
public Result<PageData<TbFuseDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||||
PageData<TbFuseDTO> page = tbFuseService.page(params);
|
PageData<TbFuseDTO> page = tbFuseService.page(params);
|
||||||
return new Result<PageData<TbFuseDTO>>().ok(page);
|
return new Result<PageData<TbFuseDTO>>().ok(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@ApiOperation("信息")
|
@ApiOperation("信息")
|
||||||
public Result<TbFuseDTO> get(@PathVariable("id") Long id){
|
@LogOperation("信息")
|
||||||
|
public Result<TbFuseDTO> get(@PathVariable("id") Long id) {
|
||||||
return new Result<TbFuseDTO>().ok(tbFuseService.getFuseById(id));
|
return new Result<TbFuseDTO>().ok(tbFuseService.getFuseById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation("保存")
|
@ApiOperation("保存")
|
||||||
@LogOperation("保存")
|
@LogOperation("保存")
|
||||||
public Result save(@RequestBody TbFuseDTO dto){
|
public Result save(@RequestBody TbFuseDTO dto) {
|
||||||
//效验数据
|
//效验数据
|
||||||
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
|
||||||
return new Result().ok(tbFuseService.addFuse(dto));
|
return new Result().ok(tbFuseService.addFuse(dto));
|
||||||
|
@ -75,16 +79,17 @@ public class FuseController {
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@ApiOperation("修改")
|
@ApiOperation("修改")
|
||||||
@LogOperation("修改")
|
@LogOperation("修改")
|
||||||
public Result update(@RequestBody TbFuseDTO dto){
|
public Result update(@RequestBody TbFuseDTO dto) {
|
||||||
//效验数据
|
//效验数据
|
||||||
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||||
return new Result().ok(tbFuseService.updateFuse(dto));
|
return new Result().ok(tbFuseService.updateFuse(dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteMapping
|
@DeleteMapping("/delete")
|
||||||
@ApiOperation("删除")
|
@ApiOperation("删除")
|
||||||
@LogOperation("删除")
|
@LogOperation("删除")
|
||||||
public Result delete(@RequestBody Long id){
|
public Result delete(@RequestBody Long[] fuseIds) {
|
||||||
return new Result().ok(tbFuseService.deleteFuse(id));
|
Arrays.stream(fuseIds).forEach(id->tbFuseService.deleteFuse(id));
|
||||||
|
return new Result();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
package io.renren.modules.fuse.dao;
|
package io.renren.modules.fuse.dao;
|
||||||
|
|
||||||
import io.renren.common.dao.BaseDao;
|
import io.renren.common.dao.BaseDao;
|
||||||
|
import io.renren.modules.fuse.dto.TbFuseDTO;
|
||||||
import io.renren.modules.fuse.entity.TbFuseEntity;
|
import io.renren.modules.fuse.entity.TbFuseEntity;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Auther:lizhicheng2@hisense.com
|
* @Auther:lizhicheng2@hisense.com
|
||||||
* @date:2022/6/30
|
* @date:2022/6/30
|
||||||
|
@ -12,4 +16,8 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface TbFuseDao extends BaseDao<TbFuseEntity> {
|
public interface TbFuseDao extends BaseDao<TbFuseEntity> {
|
||||||
|
|
||||||
|
List<TbFuseDTO> getFuseDTOList(Map params);
|
||||||
|
|
||||||
|
List<Map<String, Object>> selectGroupByDeptId();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,10 @@ public class TbFuseDTO {
|
||||||
private Long updater;
|
private Long updater;
|
||||||
@ApiModelProperty(value = "更新时间")
|
@ApiModelProperty(value = "更新时间")
|
||||||
private Date updateDate;
|
private Date updateDate;
|
||||||
|
@ApiModelProperty(value = "收藏标志")
|
||||||
|
private String isCollect;
|
||||||
|
@ApiModelProperty(value = "收藏量")
|
||||||
|
private Integer collectCount;
|
||||||
@ApiModelProperty(value = "资源融合关系")
|
@ApiModelProperty(value = "资源融合关系")
|
||||||
private List<TbFuseResourceDTO> fuseResourceList;
|
private List<TbFuseResourceDTO> fuseResourceList;
|
||||||
@ApiModelProperty(value = "融合资源属性")
|
@ApiModelProperty(value = "融合资源属性")
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.renren.modules.fuse.dto;
|
package io.renren.modules.fuse.dto;
|
||||||
|
|
||||||
|
import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -22,5 +23,7 @@ public class TbFuseResourceDTO {
|
||||||
private Long resourceId;
|
private Long resourceId;
|
||||||
@ApiModelProperty(value = "资源挂载顺序")
|
@ApiModelProperty(value = "资源挂载顺序")
|
||||||
private String sequence;
|
private String sequence;
|
||||||
|
@ApiModelProperty(value = "资源")
|
||||||
|
private ResourceDTO resource;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class TbFuseEntity extends BaseEntity {
|
||||||
/**
|
/**
|
||||||
* 所属部门
|
* 所属部门
|
||||||
*/
|
*/
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
/**
|
/**
|
||||||
* 部门联系人
|
* 部门联系人
|
||||||
|
|
|
@ -2,7 +2,6 @@ package io.renren.modules.fuse.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import io.renren.common.entity.BaseEntity;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
|
|
@ -21,4 +21,6 @@ public interface TbFuseService extends CrudService<TbFuseEntity, TbFuseDTO> {
|
||||||
|
|
||||||
Integer deleteFuse(Long id);
|
Integer deleteFuse(Long id);
|
||||||
|
|
||||||
|
Integer count(Map<String, Object> params);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package io.renren.modules.fuse.service.impl;
|
package io.renren.modules.fuse.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
||||||
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.core.toolkit.StringUtils;
|
||||||
|
import io.renren.common.constant.Constant;
|
||||||
import io.renren.common.page.PageData;
|
import io.renren.common.page.PageData;
|
||||||
import io.renren.common.service.impl.CrudServiceImpl;
|
import io.renren.common.service.impl.CrudServiceImpl;
|
||||||
import io.renren.modules.fuse.dao.TbFuseAttrDao;
|
import io.renren.modules.fuse.dao.TbFuseAttrDao;
|
||||||
|
@ -16,7 +16,10 @@ import io.renren.modules.fuse.entity.TbFuseAttrEntity;
|
||||||
import io.renren.modules.fuse.entity.TbFuseEntity;
|
import io.renren.modules.fuse.entity.TbFuseEntity;
|
||||||
import io.renren.modules.fuse.entity.TbFuseResourceEntity;
|
import io.renren.modules.fuse.entity.TbFuseResourceEntity;
|
||||||
import io.renren.modules.fuse.service.TbFuseService;
|
import io.renren.modules.fuse.service.TbFuseService;
|
||||||
|
import io.renren.modules.resource.service.ResourceService;
|
||||||
import io.renren.modules.resource.service.impl.ResourceServiceImpl;
|
import io.renren.modules.resource.service.impl.ResourceServiceImpl;
|
||||||
|
import io.renren.modules.resourceCollection.dao.ResourceCollectionDao;
|
||||||
|
import io.renren.modules.security.user.SecurityUser;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
@ -24,8 +27,7 @@ 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 java.util.List;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -44,6 +46,10 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
private TbFuseResourceDao fuseResourceDao;
|
private TbFuseResourceDao fuseResourceDao;
|
||||||
@Autowired
|
@Autowired
|
||||||
private TbFuseAttrDao fuseAttrDao;
|
private TbFuseAttrDao fuseAttrDao;
|
||||||
|
@Autowired
|
||||||
|
private ResourceService resourceService;
|
||||||
|
@Autowired
|
||||||
|
private ResourceCollectionDao resourceCollectionDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryWrapper<TbFuseEntity> getWrapper(Map<String, Object> params) {
|
public QueryWrapper<TbFuseEntity> getWrapper(Map<String, Object> params) {
|
||||||
|
@ -95,31 +101,57 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageData<TbFuseDTO> page(Map<String, Object> params){
|
public PageData<TbFuseDTO> page(Map<String, Object> params) {
|
||||||
IPage<TbFuseEntity> page = baseDao.selectPage(
|
long curPage = 1;
|
||||||
getPage(params, null, false),
|
long limit = 10;
|
||||||
getWrapper(params)
|
if (params.get(Constant.PAGE) != null) {
|
||||||
);
|
curPage = Long.parseLong((String) params.get(Constant.PAGE));
|
||||||
List<TbFuseDTO> result=page.getRecords().stream().map(entity->{
|
}
|
||||||
TbFuseDTO dto=new TbFuseDTO();
|
if (params.get(Constant.LIMIT) != null) {
|
||||||
BeanUtils.copyProperties(entity, dto);
|
limit = Long.parseLong((String) params.get(Constant.LIMIT));
|
||||||
|
}
|
||||||
|
params.put("userId", SecurityUser.getUserId());
|
||||||
|
List<TbFuseDTO> dtoList = baseDao.getFuseDTOList(params);
|
||||||
|
dtoList.forEach(dto -> {
|
||||||
dto.setFuseResourceList(getFuseResourceByFuseId(dto.getId()));
|
dto.setFuseResourceList(getFuseResourceByFuseId(dto.getId()));
|
||||||
dto.setFuseAttrList(getAttrByFuseId(dto.getId()));
|
dto.setFuseAttrList(getAttrByFuseId(dto.getId()));
|
||||||
return dto;
|
});
|
||||||
}).collect(Collectors.toList());
|
List<TbFuseDTO> result = dtoList.stream().skip((curPage - 1) * limit).limit(limit).collect(Collectors.toList());
|
||||||
return new PageData(result, page.getTotal());
|
return new PageData(result, dtoList.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer count(Map<String, Object> params) {
|
||||||
|
if (params != null) {
|
||||||
|
return baseDao.selectCount(getWrapper(params));
|
||||||
|
} else {
|
||||||
|
return baseDao.selectCount(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TbFuseDTO getFuseById(Long id) {
|
public TbFuseDTO getFuseById(Long id) {
|
||||||
TbFuseEntity fuseEntity = fuseDao.selectById(id);
|
TbFuseEntity fuseEntity = fuseDao.selectById(id);
|
||||||
|
if(fuseEntity==null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
TbFuseDTO fuseDTO = new TbFuseDTO();
|
TbFuseDTO fuseDTO = new TbFuseDTO();
|
||||||
BeanUtils.copyProperties(fuseEntity, fuseDTO);
|
BeanUtils.copyProperties(fuseEntity, fuseDTO);
|
||||||
fuseDTO.setFuseAttrList(getAttrByFuseId(id));
|
fuseDTO.setFuseAttrList(getAttrByFuseId(id));
|
||||||
fuseDTO.setFuseResourceList(getFuseResourceByFuseId(id));
|
fuseDTO.setFuseResourceList(getFuseResourceByFuseId(id));
|
||||||
|
setCollection(fuseDTO);
|
||||||
return fuseDTO;
|
return fuseDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setCollection(TbFuseDTO dto) {
|
||||||
|
QueryWrapper wrapper = new QueryWrapper();
|
||||||
|
wrapper.eq("del_flag", "0");
|
||||||
|
wrapper.eq("resource_id", dto.getId());
|
||||||
|
dto.setCollectCount(resourceCollectionDao.selectCount(wrapper));
|
||||||
|
wrapper.eq("user_id", SecurityUser.getUserId());
|
||||||
|
dto.setIsCollect(resourceCollectionDao.selectCount(wrapper) > 0 ? "true" : "false");
|
||||||
|
}
|
||||||
|
|
||||||
private List<TbFuseAttrDTO> getAttrByFuseId(Long fuseId) {
|
private List<TbFuseAttrDTO> getAttrByFuseId(Long fuseId) {
|
||||||
QueryWrapper wrapper = new QueryWrapper();
|
QueryWrapper wrapper = new QueryWrapper();
|
||||||
wrapper.eq("fuse_id", fuseId);
|
wrapper.eq("fuse_id", fuseId);
|
||||||
|
@ -138,6 +170,7 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
return list.stream().map(attr -> {
|
return list.stream().map(attr -> {
|
||||||
TbFuseResourceDTO dto = new TbFuseResourceDTO();
|
TbFuseResourceDTO dto = new TbFuseResourceDTO();
|
||||||
BeanUtils.copyProperties(attr, dto);
|
BeanUtils.copyProperties(attr, dto);
|
||||||
|
dto.setResource(resourceService.get(dto.getResourceId()));
|
||||||
return dto;
|
return dto;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
@ -147,18 +180,18 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
public Integer addFuse(TbFuseDTO dto) {
|
public Integer addFuse(TbFuseDTO dto) {
|
||||||
TbFuseEntity fuseEntity = new TbFuseEntity();
|
TbFuseEntity fuseEntity = new TbFuseEntity();
|
||||||
BeanUtils.copyProperties(dto, fuseEntity);
|
BeanUtils.copyProperties(dto, fuseEntity);
|
||||||
int result=fuseDao.insert(fuseEntity);
|
int result = fuseDao.insert(fuseEntity);
|
||||||
dto.getFuseResourceList().forEach(fuseResourceDTO->{
|
dto.getFuseResourceList().forEach(fuseResourceDTO -> {
|
||||||
fuseResourceDTO.setId(IdWorker.getId(fuseResourceDTO));
|
fuseResourceDTO.setId(IdWorker.getId(fuseResourceDTO));
|
||||||
fuseResourceDTO.setFuseId(fuseEntity.getId());
|
fuseResourceDTO.setFuseId(fuseEntity.getId());
|
||||||
TbFuseResourceEntity entity=new TbFuseResourceEntity();
|
TbFuseResourceEntity entity = new TbFuseResourceEntity();
|
||||||
BeanUtils.copyProperties(fuseResourceDTO, entity);
|
BeanUtils.copyProperties(fuseResourceDTO, entity);
|
||||||
fuseResourceDao.insert(entity);
|
fuseResourceDao.insert(entity);
|
||||||
});
|
});
|
||||||
dto.getFuseAttrList().forEach(fuseAttrDTO -> {
|
dto.getFuseAttrList().forEach(fuseAttrDTO -> {
|
||||||
fuseAttrDTO.setId(IdWorker.getId(fuseAttrDTO));
|
fuseAttrDTO.setId(IdWorker.getId(fuseAttrDTO));
|
||||||
fuseAttrDTO.setFuseId(fuseEntity.getId());
|
fuseAttrDTO.setFuseId(fuseEntity.getId());
|
||||||
TbFuseAttrEntity entity=new TbFuseAttrEntity();
|
TbFuseAttrEntity entity = new TbFuseAttrEntity();
|
||||||
BeanUtils.copyProperties(fuseAttrDTO, entity);
|
BeanUtils.copyProperties(fuseAttrDTO, entity);
|
||||||
fuseAttrDao.insert(entity);
|
fuseAttrDao.insert(entity);
|
||||||
});
|
});
|
||||||
|
@ -171,10 +204,10 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
TbFuseEntity fuseEntity = new TbFuseEntity();
|
TbFuseEntity fuseEntity = new TbFuseEntity();
|
||||||
BeanUtils.copyProperties(dto, fuseEntity);
|
BeanUtils.copyProperties(dto, fuseEntity);
|
||||||
fuseResourceDao.deleteByFuseId(fuseEntity.getId());
|
fuseResourceDao.deleteByFuseId(fuseEntity.getId());
|
||||||
dto.getFuseResourceList().forEach(fuseResourceDTO->{
|
dto.getFuseResourceList().forEach(fuseResourceDTO -> {
|
||||||
fuseResourceDTO.setId(IdWorker.getId(fuseResourceDTO));
|
fuseResourceDTO.setId(IdWorker.getId(fuseResourceDTO));
|
||||||
fuseResourceDTO.setFuseId(fuseEntity.getId());
|
fuseResourceDTO.setFuseId(fuseEntity.getId());
|
||||||
TbFuseResourceEntity entity=new TbFuseResourceEntity();
|
TbFuseResourceEntity entity = new TbFuseResourceEntity();
|
||||||
BeanUtils.copyProperties(fuseResourceDTO, entity);
|
BeanUtils.copyProperties(fuseResourceDTO, entity);
|
||||||
fuseResourceDao.insert(entity);
|
fuseResourceDao.insert(entity);
|
||||||
});
|
});
|
||||||
|
@ -182,7 +215,7 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
dto.getFuseAttrList().forEach(fuseAttrDTO -> {
|
dto.getFuseAttrList().forEach(fuseAttrDTO -> {
|
||||||
fuseAttrDTO.setId(IdWorker.getId(fuseAttrDTO));
|
fuseAttrDTO.setId(IdWorker.getId(fuseAttrDTO));
|
||||||
fuseAttrDTO.setFuseId(fuseEntity.getId());
|
fuseAttrDTO.setFuseId(fuseEntity.getId());
|
||||||
TbFuseAttrEntity entity=new TbFuseAttrEntity();
|
TbFuseAttrEntity entity = new TbFuseAttrEntity();
|
||||||
BeanUtils.copyProperties(fuseAttrDTO, entity);
|
BeanUtils.copyProperties(fuseAttrDTO, entity);
|
||||||
fuseAttrDao.insert(entity);
|
fuseAttrDao.insert(entity);
|
||||||
});
|
});
|
||||||
|
@ -194,6 +227,9 @@ public class TbFuseServiceImpl extends CrudServiceImpl<TbFuseDao, TbFuseEntity,
|
||||||
public Integer deleteFuse(Long id) {
|
public Integer deleteFuse(Long id) {
|
||||||
fuseResourceDao.deleteByFuseId(id);
|
fuseResourceDao.deleteByFuseId(id);
|
||||||
fuseAttrDao.deleteByFuseId(id);
|
fuseAttrDao.deleteByFuseId(id);
|
||||||
|
resourceCollectionDao.delete4Resource(new ArrayList<Long>() {{
|
||||||
|
this.add(id);
|
||||||
|
}});
|
||||||
return fuseDao.deleteById(id);
|
return fuseDao.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -519,13 +519,11 @@ public class ResourceController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getApplyByDept")
|
@GetMapping("/getApplyByDept")
|
||||||
@ApiOperation("获取当前登录用户所在部门申请的资源")
|
@ApiOperation("获取当前登录用户所在部门申请的资源-按照申请次数排名")
|
||||||
@LogOperation("获取当前登录用户所在部门申请的资源")
|
@LogOperation("获取当前登录用户所在部门申请的资源-按照申请次数排名")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType = "int"),
|
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataType = "int"),
|
||||||
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int"),
|
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query", required = true, dataType = "int")
|
||||||
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataType = "String"),
|
|
||||||
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataType = "String"),
|
|
||||||
})
|
})
|
||||||
public Result getApplyByDept(@ApiIgnore @RequestParam Map<String, Object> params) {
|
public Result getApplyByDept(@ApiIgnore @RequestParam Map<String, Object> params) {
|
||||||
return new Result().ok(resourceService.getApplyByDept(params));
|
return new Result().ok(resourceService.getApplyByDept(params));
|
||||||
|
@ -555,4 +553,11 @@ public class ResourceController {
|
||||||
public Result selectInfrastructureList() {
|
public Result selectInfrastructureList() {
|
||||||
return new Result().ok(resourceService.selectInfrastructureList());
|
return new Result().ok(resourceService.selectInfrastructureList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperation("能力查询")
|
||||||
|
@LogOperation("能力查询")
|
||||||
|
public Result list(@ApiIgnore @RequestParam Map<String, Object> params){
|
||||||
|
return new Result<>().ok(resourceService.list(params));
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -164,4 +164,6 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
|
||||||
Long selectDayAvg(@Param("days") Long days);
|
Long selectDayAvg(@Param("days") Long days);
|
||||||
|
|
||||||
Integer selectDayMax();
|
Integer selectDayMax();
|
||||||
|
|
||||||
|
List<ResourceDTO> selectUsersApplyAndCount(@Param("userIds") List<Long> userIds);
|
||||||
}
|
}
|
|
@ -1617,32 +1617,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
||||||
limit = Integer.parseInt((String) params.get(Constant.LIMIT));
|
limit = Integer.parseInt((String) params.get(Constant.LIMIT));
|
||||||
}
|
}
|
||||||
List<SysUserDTO> sysUserList = sysUserService.list(new HashMap());
|
List<SysUserDTO> sysUserList = sysUserService.list(new HashMap());
|
||||||
List<HistoricProcessInstance> list = new ArrayList<>();
|
List<ResourceDTO> result=resourceDao.selectUsersApplyAndCount(sysUserList.stream().map(dto->dto.getId()).collect(Collectors.toList()));
|
||||||
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();
|
int j = Math.min(curPage * limit, result.size());
|
||||||
query.orderByProcessInstanceStartTime().desc();
|
ArrayList<ResourceDTO> recordLists = new ArrayList<>();
|
||||||
for (SysUserDTO user : sysUserList) {
|
for (int i = (curPage - 1) * limit; i < j; i++) {
|
||||||
query.startedBy(user.getId().toString());
|
recordLists.add(result.get(i));
|
||||||
list.addAll(query.list());
|
|
||||||
}
|
}
|
||||||
boolean isAsc = false;
|
return new PageData<>(recordLists, result.size());
|
||||||
if (params.get(Constant.ORDER) != null && "asc".equals(params.get(Constant.ORDER))) {
|
|
||||||
isAsc = true;
|
|
||||||
}
|
|
||||||
String orderColumn = params.get(Constant.ORDER_FIELD) == null ? "create_date" : (String) params.get(Constant.ORDER_FIELD);
|
|
||||||
List<Long> resourceIds = getSourceIdsByProcess(list);
|
|
||||||
IPage<ResourceEntity> page = new Page<>(curPage, limit);
|
|
||||||
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
|
|
||||||
if (!resourceIds.isEmpty()) {
|
|
||||||
queryWrapper.in("id", resourceIds);
|
|
||||||
}
|
|
||||||
queryWrapper.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).orderBy(true, isAsc, orderColumn);
|
|
||||||
List<ResourceDTO> dtoList = ConvertUtils.sourceToTarget(Optional.ofNullable(resourceDao.selectPage(page, queryWrapper).getRecords()).orElse(new ArrayList<>()), ResourceDTO.class);
|
|
||||||
dtoList.forEach(temp -> {
|
|
||||||
Map p = new HashMap();
|
|
||||||
p.put("resource_id", temp.getId());
|
|
||||||
temp.setApplyCount(String.valueOf(tAbilityApplicationService.list(p).size()));
|
|
||||||
});
|
|
||||||
return new PageData<>(dtoList, dtoList.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,9 +20,9 @@ public interface ResourceCollectionDao extends BaseDao<ResourceCollectionEntity>
|
||||||
|
|
||||||
Integer deleteByIds(@Param("ids") Long[] ids);
|
Integer deleteByIds(@Param("ids") Long[] ids);
|
||||||
|
|
||||||
List<ResourceCollectionDTO> selectPageWithResource(@Param("params") Map<String, Object> params,
|
List<ResourceCollectionDTO> selectWithResource(@Param("params") Map<String, Object> params);
|
||||||
@Param("pageNum") Integer pageNum,
|
|
||||||
@Param("pageSize") Integer pageSize);
|
List<ResourceCollectionDTO> selectWithFuse(@Param("params") Map<String, Object> params);
|
||||||
|
|
||||||
Integer delete4Resource(@Param("resourceIds") List<Long> idList);
|
Integer delete4Resource(@Param("resourceIds") List<Long> idList);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package io.renren.modules.resourceCollection.dto;
|
package io.renren.modules.resourceCollection.dto;
|
||||||
|
|
||||||
|
import io.renren.modules.fuse.dto.TbFuseDTO;
|
||||||
import io.renren.modules.resource.dto.ResourceDTO;
|
import io.renren.modules.resource.dto.ResourceDTO;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
@ -47,4 +48,6 @@ public class ResourceCollectionDTO implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty(value = "资源信息")
|
@ApiModelProperty(value = "资源信息")
|
||||||
private ResourceDTO resourceDTO;
|
private ResourceDTO resourceDTO;
|
||||||
|
@ApiModelProperty(value = "融合服务信息")
|
||||||
|
private TbFuseDTO fuseDTO;
|
||||||
}
|
}
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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.fuse.service.TbFuseService;
|
||||||
import io.renren.modules.resource.service.ResourceService;
|
import io.renren.modules.resource.service.ResourceService;
|
||||||
import io.renren.modules.resourceCollection.dao.ResourceCollectionDao;
|
import io.renren.modules.resourceCollection.dao.ResourceCollectionDao;
|
||||||
import io.renren.modules.resourceCollection.dto.ResourceCollectionDTO;
|
import io.renren.modules.resourceCollection.dto.ResourceCollectionDTO;
|
||||||
|
@ -16,6 +17,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -37,6 +39,8 @@ public class ResourceCollectionServiceImpl extends CrudServiceImpl<ResourceColle
|
||||||
private ResourceService resourceService;
|
private ResourceService resourceService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcTemplate jdbcTemplate;
|
private JdbcTemplate jdbcTemplate;
|
||||||
|
@Autowired
|
||||||
|
private TbFuseService fuseService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryWrapper<ResourceCollectionEntity> getWrapper(Map<String, Object> params) {
|
public QueryWrapper<ResourceCollectionEntity> getWrapper(Map<String, Object> params) {
|
||||||
|
@ -51,11 +55,27 @@ public class ResourceCollectionServiceImpl extends CrudServiceImpl<ResourceColle
|
||||||
int pageSize = Integer.parseInt(params.get("pageSize").toString());
|
int pageSize = Integer.parseInt(params.get("pageSize").toString());
|
||||||
Page<ResourceCollectionDTO> page = new Page(pageNum, pageSize);
|
Page<ResourceCollectionDTO> page = new Page(pageNum, pageSize);
|
||||||
params.put("userId", user.getId());
|
params.put("userId", user.getId());
|
||||||
List<ResourceCollectionDTO> resourceCollectionDTOS = resourceCollectionDao.selectPageWithResource(params, (pageNum - 1) * pageSize, pageSize);
|
List<ResourceCollectionDTO> result=new ArrayList<>();
|
||||||
|
List<ResourceCollectionDTO> resourceCollectionDTOS = resourceCollectionDao.selectWithResource(params);
|
||||||
resourceCollectionDTOS.forEach(item -> item.setResourceDTO(resourceService.selectWithAttrs(item.getResourceId())));
|
resourceCollectionDTOS.forEach(item -> item.setResourceDTO(resourceService.selectWithAttrs(item.getResourceId())));
|
||||||
List<ResourceCollectionDTO> resourceCollectionDTOSs = resourceCollectionDao.selectPageWithResource(params, 0, 100000);
|
result.addAll(resourceCollectionDTOS);
|
||||||
page.setRecords(resourceCollectionDTOS);
|
if(params.get("type") == null || "".equals(params.get("type"))){
|
||||||
page.setTotal(resourceCollectionDTOSs.size());
|
List<ResourceCollectionDTO> fuseCollectionDTOS = resourceCollectionDao.selectWithFuse(params);
|
||||||
|
fuseCollectionDTOS.forEach(item -> item.setFuseDTO(fuseService.getFuseById(item.getResourceId())));
|
||||||
|
result.addAll(fuseCollectionDTOS);
|
||||||
|
}
|
||||||
|
int j = Math.min(pageNum * pageSize, result.size());
|
||||||
|
if (result.isEmpty()) {
|
||||||
|
page.setRecords(null);
|
||||||
|
page.setTotal(0);
|
||||||
|
} else {
|
||||||
|
ArrayList<ResourceCollectionDTO> recordLists = new ArrayList<>();
|
||||||
|
for (int i = (pageNum - 1) * pageSize; i < j; i++) {
|
||||||
|
recordLists.add(result.get(i));
|
||||||
|
}
|
||||||
|
page.setRecords(recordLists);
|
||||||
|
page.setTotal(result.size());
|
||||||
|
}
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,15 +11,13 @@ import io.renren.modules.sys.dto.SysDeptDTO;
|
||||||
import io.renren.modules.sys.service.SysDeptService;
|
import io.renren.modules.sys.service.SysDeptService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门管理
|
* 部门管理
|
||||||
|
@ -47,9 +45,13 @@ public class SysDeptController {
|
||||||
@ApiOperation("查询所有部门列表")
|
@ApiOperation("查询所有部门列表")
|
||||||
@LogOperation("查询所有部门列表")
|
@LogOperation("查询所有部门列表")
|
||||||
// @RequiresPermissions("sys:dept:list")
|
// @RequiresPermissions("sys:dept:list")
|
||||||
public Result<List<Map<String, Object>>> all() {
|
public Result<List<Map<String, Object>>> all(String name) {
|
||||||
List<Map<String, Object>> list = jdbcTemplate.queryForList("SELECT id,`name` FROM sys_dept;");
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
if (StringUtils.isNotEmpty(name)) {
|
||||||
|
list = jdbcTemplate.queryForList(String.format("SELECT id,`name` FROM sys_dept WHERE `name` LIKE '%s';", name));
|
||||||
|
} else {
|
||||||
|
list = jdbcTemplate.queryForList("SELECT id,`name` FROM sys_dept;");
|
||||||
|
}
|
||||||
return new Result<List<Map<String, Object>>>().ok(list);
|
return new Result<List<Map<String, Object>>>().ok(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,5 +2,84 @@
|
||||||
<!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="io.renren.modules.fuse.dao.TbFuseDao">
|
<mapper namespace="io.renren.modules.fuse.dao.TbFuseDao">
|
||||||
|
|
||||||
|
<resultMap id="fuseDTO" type="io.renren.modules.fuse.dto.TbFuseDTO">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
<result property="description" column="description"/>
|
||||||
|
<result property="applicationArea" column="application_area"/>
|
||||||
|
<result property="deptId" column="dept_id"/>
|
||||||
|
<result property="deptUser" column="dept_user"/>
|
||||||
|
<result property="mobile" column="mobile"/>
|
||||||
|
<result property="provider" column="provider"/>
|
||||||
|
<result property="providerUser" column="provider_user"/>
|
||||||
|
<result property="providerMobile" column="provider_mobile"/>
|
||||||
|
<result property="creator" column="creator"/>
|
||||||
|
<result property="createDate" column="create_date"/>
|
||||||
|
<result property="updater" column="updater"/>
|
||||||
|
<result property="updateDate" column="update_date"/>
|
||||||
|
<result property="isCollect" column="isCollect"/>
|
||||||
|
<result property="collectCount" column="collectCount"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="getFuseDTOList" resultMap="fuseDTO">
|
||||||
|
select tf.*, count(trc.id) as collectCount, if(sum(trc.user_id=#{userId})>0 , 'true', 'false') as isCollect
|
||||||
|
from tb_fuse tf left join (select id, resource_Id, user_id from tb_resource_collection where 1=1 and del_flag=0) trc on tf.id=trc.resource_id
|
||||||
|
where 1=1
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
and name like concat('%', #{name}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="description != null and description != ''">
|
||||||
|
and description like concat('%', #{description}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="applicationArea != null and applicationArea != ''">
|
||||||
|
and application_area like concat('%', #{applicationArea}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="deptId != null and deptId != ''">
|
||||||
|
and deptId = #{deptId}
|
||||||
|
</if>
|
||||||
|
<if test="deptUser != null and deptUser != ''">
|
||||||
|
and dept_user like concat('%', #{deptUser}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="mobile != null and mobile != ''">
|
||||||
|
and mobile like concat('%', #{mobile}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="provider != null and provider != ''">
|
||||||
|
and provider like concat('%', #{provider}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="providerUser != null and providerUser != ''">
|
||||||
|
and provider_user like concat('%', #{providerUser}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="providerMobile != null and providerMobile != ''">
|
||||||
|
and provider_mobile like concat('%', #{providerMobile}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="creator != null and creator != ''">
|
||||||
|
and creator = #{creator}
|
||||||
|
</if>
|
||||||
|
<if test="createDate != null and createDate != ''">
|
||||||
|
and create_date #{createDate}
|
||||||
|
</if>
|
||||||
|
<if test="updater != null and updater != ''">
|
||||||
|
and updater = #{updater}
|
||||||
|
</if>
|
||||||
|
<if test="updateDate != null and updateDate != ''">
|
||||||
|
and updateDate #{updateDate}
|
||||||
|
</if>
|
||||||
|
group by tf.id
|
||||||
|
ORDER BY ${orderField} ${orderType}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectGroupByDeptId" resultType="java.util.Map">
|
||||||
|
SELECT ( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
|
||||||
|
sd.NAME AS "deptName",
|
||||||
|
count(tdr.id) AS "deptCount",
|
||||||
|
sd.id AS "deptId",
|
||||||
|
sr.name AS "districtName",
|
||||||
|
sr.id AS "districtId"
|
||||||
|
FROM sys_dept sd
|
||||||
|
inner join tb_fuse tdr on sd.id=tdr.dept_id
|
||||||
|
left join sys_region sr on sr.id=sd.district
|
||||||
|
group by sd.id
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
|
@ -1336,10 +1336,13 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeptResourceByApplyNum" resultType="java.util.Map">
|
<select id="selectDeptResourceByApplyNum" resultType="java.util.Map">
|
||||||
SELECT count(taa.id) as count, tdr.name
|
SELECT tdr.name, count(taa.id) as count
|
||||||
FROM tb_data_resource tdr left join t_ability_application taa on tdr.id=taa.resource_id
|
FROM tb_data_resource tdr left join t_ability_application taa on tdr.id=taa.resource_id
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
AND tdr.del_flag = 0
|
||||||
<if test="null != list">
|
<if test="null != list">
|
||||||
where tdr.dept_id in
|
and tdr.dept_id in
|
||||||
<foreach item="deptId" collection="list" open="(" separator="," close=")">
|
<foreach item="deptId" collection="list" open="(" separator="," close=")">
|
||||||
#{deptId}
|
#{deptId}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
@ -1347,6 +1350,21 @@
|
||||||
group by tdr.id order by count desc
|
group by tdr.id order by count desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectUsersApplyAndCount" resultMap="resourceDTO">
|
||||||
|
SELECT tdr.*, count(taa.id) as applyCount
|
||||||
|
FROM tb_data_resource tdr left join t_ability_application taa on tdr.id=taa.resource_id
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
|
AND tdr.del_flag = 0
|
||||||
|
<if test="null != userIds">
|
||||||
|
and taa.user_id in
|
||||||
|
<foreach item="userId" collection="userIds" open="(" separator="," close=")">
|
||||||
|
#{userId}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
group by tdr.id order by applyCount desc
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="trafficDeptResource" resultType="java.util.Map">
|
<select id="trafficDeptResource" resultType="java.util.Map">
|
||||||
SELECT
|
SELECT
|
||||||
SUBSTR(create_date, 1, 10) AS "date",
|
SUBSTR(create_date, 1, 10) AS "date",
|
||||||
|
|
|
@ -53,12 +53,10 @@
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="selectPageWithResource" resultType="io.renren.modules.resourceCollection.dto.ResourceCollectionDTO">
|
<select id="selectWithResource" resultType="io.renren.modules.resourceCollection.dto.ResourceCollectionDTO">
|
||||||
SELECT trc.*
|
SELECT trc.*
|
||||||
FROM tb_resource_collection trc
|
FROM tb_resource_collection trc
|
||||||
<if test="(params.type != null and params.type != '') or (params.name != null and params.name != '')">
|
INNER JOIN tb_data_resource tdr ON trc.resource_id = tdr.id AND tdr.del_flag != 1
|
||||||
LEFT JOIN tb_data_resource tdr ON trc.resource_id = tdr.id AND tdr.del_flag != 1
|
|
||||||
</if>
|
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
AND trc.del_flag = 0
|
AND trc.del_flag = 0
|
||||||
AND user_id = #{params.userId}
|
AND user_id = #{params.userId}
|
||||||
|
@ -69,7 +67,19 @@
|
||||||
AND tdr.type = #{params.type}
|
AND tdr.type = #{params.type}
|
||||||
</if>
|
</if>
|
||||||
ORDER BY trc.update_date DESC, trc.create_date DESC
|
ORDER BY trc.update_date DESC, trc.create_date DESC
|
||||||
LIMIT ${pageNum}, ${pageSize}
|
</select>
|
||||||
|
|
||||||
|
<select id="selectWithFuse" resultType="io.renren.modules.resourceCollection.dto.ResourceCollectionDTO">
|
||||||
|
SELECT trc.*
|
||||||
|
FROM tb_resource_collection trc
|
||||||
|
INNER JOIN tb_fuse tf ON trc.resource_id = tf.id
|
||||||
|
WHERE 1 = 1
|
||||||
|
AND trc.del_flag = 0
|
||||||
|
AND user_id = #{params.userId}
|
||||||
|
<if test="params.name != null and params.name != ''" >
|
||||||
|
AND tf.name LIKE CONCAT('%',#{params.name},'%')
|
||||||
|
</if>
|
||||||
|
ORDER BY trc.update_date DESC, trc.create_date DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue