Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-06-30 17:47:07 +08:00
commit 409b9b865e
10 changed files with 245 additions and 81 deletions

View File

@ -62,14 +62,19 @@ public class CensusControllerV3 {
})
public Result<PageData<Map<String, Object>>> resourceAssemblerDetails(@ApiIgnore @RequestParam Map<String, Object> params){
UserDetail user = SecurityUser.getUser();
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
if(StringUtils.equals(user.getUsername(),"admin") || StringUtils.equals(sysDeptDTO.getName(),qddsjj)){//admin和市大数据局显示所有
if(StringUtils.equals(user.getUsername(),"admin")){
params.put("id",0);
}else if(StringUtils.contains(sysDeptDTO.getName(),"大数据") && sysDeptDTO.getType() == 3){//各区大数据局
params.put("id",sysDeptDTO.getPid());
}else{
params.put("id",sysDeptDTO.getId());
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
if(StringUtils.equals(sysDeptDTO.getName(),qddsjj)){
params.put("id",0);
}else if(StringUtils.contains(sysDeptDTO.getName(),"大数据") && sysDeptDTO.getType() == 3){
params.put("id",sysDeptDTO.getPid());
}else{
params.put("id",sysDeptDTO.getId());
}
}
String type = params.get("resourceType").toString();
List<Map<String,Object>> list = new ArrayList<>();
@ -104,14 +109,19 @@ public class CensusControllerV3 {
})
public Result<PageData<Map<String, Object>>> resourceUsedDetails(@ApiIgnore @RequestParam Map<String, Object> params){
UserDetail user = SecurityUser.getUser();
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
if(StringUtils.equals(user.getUsername(),"admin") || StringUtils.equals(sysDeptDTO.getName(),qddsjj)){//admin和市大数据局显示所有
if(StringUtils.equals(user.getUsername(),"admin")){
params.put("id",0);
}else if(StringUtils.contains(sysDeptDTO.getName(),"大数据") && sysDeptDTO.getType() == 3){//各区大数据局
params.put("id",sysDeptDTO.getPid());
}else{
params.put("id",sysDeptDTO.getId());
SysDeptDTO sysDeptDTO = sysDeptService.get(user.getDeptId());
if(StringUtils.equals(sysDeptDTO.getName(),qddsjj)){
params.put("id",0);
}else if(StringUtils.contains(sysDeptDTO.getName(),"大数据") && sysDeptDTO.getType() == 3){
params.put("id",sysDeptDTO.getPid());
}else{
params.put("id",sysDeptDTO.getId());
}
}
String type = params.get("resourceType").toString();
List<Map<String,Object>> list = new ArrayList<>();
@ -176,22 +186,16 @@ public class CensusControllerV3 {
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerCaredTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] args = {params.get("id"),params.get("resourceType")};
Object[] args = {params.get("id"),params.get("id"),params.get("resourceType")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT a.resource_id,b.name,COUNT(a.id) AS resourceCarNum\n" +
"FROM tb_resource_car a \n" +
"INNER JOIN tb_data_resource b \n" +
"ON a.resource_id = b.id\n" +
"WHERE\n" +
"b.dept_id = ?\n" +
"AND\n" +
"b.type = ?\n" +
"AND \n" +
"a.del_flag = 0\n" +
"\n" +
"GROUP BY a.resource_id,b.name \n" +
"ORDER BY COUNT(a.id) DESC\n" +
"LIMIT 5", args);
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT a.resource_id,b.name,COUNT(a.id) AS resourceCarNum FROM tb_resource_car a \n" +
" INNER JOIN tb_data_resource b ON a.resource_id = b.id\n" +
" INNER JOIN sys_dept c ON b.dept_id = c.id\n" +
" WHERE (c.id = ? OR INSTR(c.pids,?)) AND b.type = ?\n" +
" AND a.del_flag = 0\n" +
" GROUP BY a.resource_id,b.name \n" +
" ORDER BY COUNT(a.id) DESC\n" +
" LIMIT 5", args);
return new Result<List<Map<String, Object>>>().ok(maps);
}
@ -205,9 +209,10 @@ public class CensusControllerV3 {
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerUsedInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("id"),params.get("resourceType")};
Object[] ps = {params.get("id"),params.get("id"),params.get("resourceType")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT count(b.attr_value) as nums,b.attr_value FROM tb_data_resource a INNER JOIN tb_data_attr b ON a.id = b.data_resource_id\n" +
"WHERE a.dept_id = ? and a.type = ? and b.attr_type = '组件类型'\n" +
"INNER JOIN sys_dept c ON a.dept_id = c.id \n" +
"WHERE (c.id = ? OR INSTR(c.pids,?)) and a.type = ? and b.attr_type = '组件类型'\n" +
"GROUP BY b.attr_value", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
@ -229,9 +234,9 @@ public class CensusControllerV3 {
@ApiImplicitParam(name = "resourceType",value = "资源类型(组件服务、应用资源、基础设施、数据资源、知识库)", paramType = "query", dataType = "String")
})
public Result<List<Map<String, Object>>> assemblerUseTopInfo(@ApiIgnore @RequestParam Map<String, Object> params){
Object[] ps = {params.get("resourceType"),params.get("id")};
Object[] ps = {params.get("resourceType"),params.get("id"),params.get("id")};
List<Map<String, Object>> maps = jdbcTemplate.queryForList("SELECT b.name,count(a.id) AS useNum FROM tb_data_resource_rel a INNER JOIN tb_data_resource b ON a.reference_id = b.id\n" +
"WHERE a.del_flag = 0 AND b.type = ? AND b.dept_id = ? GROUP BY b.name ORDER BY useNum desc LIMIT 5", ps);
"INNER JOIN sys_dept c ON b.dept_id = c.id WHERE a.del_flag = 0 AND b.type = ? AND (c.id = ? OR INSTR(c.pids,?)) GROUP BY b.name ORDER BY useNum desc LIMIT 5", ps);
return new Result<List<Map<String,Object>>>().ok(maps);
}

View File

@ -10,6 +10,7 @@ import io.renren.modules.demanData.entity.TDemandDataEntityFlag;
import io.renren.modules.demanData.service.TDemandDataService;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.dao.SysDeptDao;
import io.renren.modules.sys.service.SysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -27,7 +28,7 @@ import java.util.Map;
public class TDemandDataServiceImpl extends CrudServiceImpl<TDemandDataDao, TDemandDataEntity, TDemandDataDTO> implements TDemandDataService {
@Autowired
private SysDeptDao sysDeptDao;
private SysDeptService deptService;
@Override
@ -71,8 +72,10 @@ public class TDemandDataServiceImpl extends CrudServiceImpl<TDemandDataDao, TDem
public Object selectFlagCountByDepts() {
HashMap<String, Object> resultMap = new HashMap<>();
Long deptId = SecurityUser.getUser().getDeptId();
List<Long> deptList = sysDeptDao.getSubDeptIdList(deptId.toString());
deptList.add(deptId);
List<Long> deptList=null;
if(deptId != null){
deptList = deptService.getSubDeptIdList(deptId);
}
List<Map> list = baseDao.selectFlagCountByDepts(deptList);
list.forEach(temp -> {
temp.put("flag", TDemandDataEntityFlag.getByFlag(Integer.parseInt(temp.get("flag").toString())).getTip());

View File

@ -88,7 +88,9 @@ public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao
CompletableFuture.runAsync(() -> { // 发起人
Optional<TDemandDataDTO> tDemandDataDTO = Optional.ofNullable(tDemandDataService.get(tDemandCommentDTO.getTargetId()));
Optional<SysUserDTO> sysUserDTO = Optional.ofNullable(sysUserService.get(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator() : null));
String content = "【评论】" + (sysUserDTO.isPresent() ? sysUserDTO.get().getRealName() : "") + "您发起的需求 " + tDemandDataDTO.orElse(new TDemandDataDTO()).getDemandSubject() + "有新的评论,请前往查看详情";
String content = "【评论】" + (sysUserDTO.isPresent() ? sysUserDTO.get().getRealName() : "") + "您发起的需求 " + tDemandDataDTO.orElse(new TDemandDataDTO()).getDemandSubject()
// + "有新的评论,请前往查看详情"
;
SysNoticeDTO dto = new SysNoticeDTO();
dto.setType(2);
dto.setTitle("需求评论系统通知");

View File

@ -493,6 +493,19 @@ public class ResourceController {
return new Result().ok(resourceService.getByDept(params));
}
@PostMapping("/trafficDeptResource")
@ApiOperation("按天统计指定时间内本部门发布的资源")
@LogOperation("按天统计指定时间内本部门发布的资源")
public Result trafficDeptResource(@RequestBody JSONObject jsonObject) {
HashMap<String, Object> resultMap = new HashMap<>();
String startDate = jsonObject.getString("startDate");
String endDate = jsonObject.getString("endDate");
resultMap.put("browseAvg", resourceService.selectDayAvg());
resultMap.put("browseMax", resourceService.selectDayMax());
resultMap.put("browseDayList", resourceService.trafficDeptResource(startDate, endDate));
return new Result().ok(resultMap);
}
@GetMapping("/selectTotalByDept")
@ApiOperation("按照资源类型统计本部门发布的资源")
@LogOperation("按照资源类型统计本部门发布的资源")

View File

@ -158,4 +158,10 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
List<ResourceDTO> selectCameraDTOById(@Param("id") Long id);
List<Map> selectDeptResourceByApplyNum(List<Long> deptIds);
List<Map> trafficDeptResource(Map params);
Long selectDayAvg(@Param("days") Long days);
Integer selectDayMax();
}

View File

@ -119,4 +119,10 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
Object selectDeptResourceByApplyNum(Map<String, Object> params);
Object trafficDeptResource(String startDate, String endDate);
Object selectDayAvg();
Object selectDayMax();
}

View File

@ -14,6 +14,9 @@ import io.renren.common.constant.Constant;
import io.renren.common.domain.Tsingtao_xhaProperties;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.ConvertUtils;
import io.renren.common.utils.DateUtils;
import io.renren.modules.activiti.dto.ProcessActivityDTO;
import io.renren.modules.processForm.dao.TAbilityApplicationDao;
import io.renren.modules.processForm.dto.TAbilityApplicationDTO;
import io.renren.modules.processForm.entity.TAbilityApplicationEntity;
@ -36,7 +39,9 @@ import io.renren.modules.resourceMountApply.service.TResourceMountApplyService;
import io.renren.modules.resourceScore.dao.ResourceScoreDao;
import io.renren.modules.security.user.SecurityUser;
import io.renren.modules.sys.dao.SysDeptDao;
import io.renren.modules.sys.dto.SysPostDTO;
import io.renren.modules.sys.dto.SysUserDTO;
import io.renren.modules.sys.service.SysDeptService;
import io.renren.modules.sys.service.SysUserService;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
@ -113,6 +118,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Value("${zsk.catalogIds}")
private String[] catalogIds;
@Value("${system.startDay}")
private String systemDay;
@Autowired
private ResourceDao resourceDao;
@ -156,6 +164,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Autowired
private TResourceMountApplyService tResourceMountApplyService;
@Autowired
private SysDeptService deptService;
@Override
public QueryWrapper<ResourceEntity> getWrapper(Map<String, Object> params) {
QueryWrapper<ResourceEntity> wrapper = new QueryWrapper<>();
@ -318,11 +329,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
} else {
List<ResourceDTO> recordLists = resourceDTOS.stream()
.skip((pageNum - 1) * pageSize).limit(pageSize)
.peek(dto_ -> {
ResourceDTO temp = dto_;
ResourceDTO get = this.get(dto_.getId());
.map(dto_ -> {
ResourceDTO get = this.selectWithAttrs(dto_.getId());
BeanUtils.copyProperties(get, dto_);
dto_.setInfoList(temp.getInfoList());
return dto_;
}).collect(Collectors.toList());
resultPage.setRecords(recordLists);
resultPage.setTotal(resourceDTOS.size());
@ -419,10 +429,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<ResourceDTO> recordLists = resourceDTOS.stream()
.skip((pageNum - 1) * pageSize).limit(pageSize)
.map(dto_ -> {
ResourceDTO temp = dto_;
ResourceDTO get = this.get(dto_.getId());
ResourceDTO get = this.selectWithAttrs(dto_.getId());
BeanUtils.copyProperties(get, dto_);
dto_.setInfoList(temp.getInfoList());
return dto_;
}).collect(Collectors.toList());
resultPage.setRecords(recordLists);
@ -1192,8 +1200,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> { //应用收藏量
result.forEach(r -> {
Object[] qu = {r.get("deptId")};
Integer integer = baseDao.selectResourceCarNum(params);
r.put("resourceCarNum", integer);
Integer integer = baseDao.selectResourceCollectionNum(params);
r.put("resourceCollectionNum", integer);
});
});
@ -1472,8 +1480,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
limit = Integer.parseInt((String) params.get(Constant.LIMIT));
}
Long deptId = SecurityUser.getUser().getDeptId();
List<Long> deptList = sysDeptDao.getSubDeptIdList(deptId.toString());
deptList.add(deptId);
List<Long> deptList=null;
if(deptId != null){
deptList = deptService.getSubDeptIdList(deptId);
}
boolean isAsc = false;
if (params.get(Constant.ORDER) != null && "asc".equals(params.get(Constant.ORDER))) {
isAsc = true;
@ -1481,7 +1491,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
String orderColumn = params.get(Constant.ORDER_FIELD) == null ? "create_date" : (String) params.get(Constant.ORDER_FIELD);
IPage<ResourceEntity> page = new Page<>(curPage, limit);
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("dept_id", deptList).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).orderBy(true, isAsc, orderColumn);
if(deptList != null){
queryWrapper.in("dept_id", deptList);
}
queryWrapper.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).orderBy(true, isAsc, orderColumn);
return resourceDao.selectPage(page, queryWrapper);
}
@ -1489,8 +1502,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public Object selectTotalByDept() {
HashMap<String, Object> resultMap = new HashMap<>();
Long deptId = SecurityUser.getUser().getDeptId();
List<Long> deptList = sysDeptDao.getSubDeptIdList(deptId.toString());
deptList.add(deptId);
List<Long> deptList=null;
if(deptId != null){
deptList = deptService.getSubDeptIdList(deptId);
}
resultMap.put("total", resourceDao.selectCountByDepts(deptList));
return resultMap;
}
@ -1522,7 +1537,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
IPage<ResourceEntity> page = new Page<>(curPage, limit);
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("id", resourceIds).eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).orderBy(true, isAsc, orderColumn);
return resourceDao.selectPage(page, queryWrapper);
List<ResourceDTO> dtoList=ConvertUtils.sourceToTarget(resourceDao.selectPage(page, queryWrapper).getRecords(), ResourceDTO.class);
dtoList.forEach(temp->{
Map p=new HashMap();
p.put("resource_id", temp.getId());
temp.setApplyCount(String.valueOf(tResourceMountApplyService.list(p).size()));
});
return new PageData<>(dtoList, dtoList.size());
}
@Override
@ -1551,10 +1572,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if (params.get(Constant.LIMIT) != null) {
limit = Integer.parseInt((String) params.get(Constant.LIMIT));
}
Long deptId = SecurityUser.getUser().getDeptId();
List<Long> deptList = sysDeptDao.getSubDeptIdList(deptId.toString());
deptList.add(deptId);
List<Map> result = resourceDao.selectDeptResourceByApplyNum(deptList);
Long deptId=SecurityUser.getUser().getDeptId();
List<Long> deptList=null;
if(deptId != null){
deptList=deptService.getSubDeptIdList(deptId);
}
List<Map> result=resourceDao.selectDeptResourceByApplyNum(deptList);
Page<Map> page = new Page(curPage, limit);
int j = Math.min(curPage * limit, result.size());
if (result.isEmpty()) {
@ -1571,6 +1594,52 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
return page;
}
@Override
public Object trafficDeptResource(String startDate, String endDate) {
Map params=new HashMap();
params.put("startDate", startDate);
params.put("endDate", endDate);
Long deptId = SecurityUser.getUser().getDeptId();
List<Long> deptList=null;
if(deptId != null){
deptList = deptService.getSubDeptIdList(deptId);
}
params.put("deptIds", deptList);
List<Map> maps = resourceDao.trafficDeptResource(params);
Date startDay = DateUtils.parse(startDate, DateUtils.DATE_PATTERN);
Date endDay = DateUtils.parse(endDate, DateUtils.DATE_PATTERN);
ArrayList<String> dayList = new ArrayList<>();
while (startDay.before(endDay) || startDay.compareTo(endDay) == 0) {
dayList.add(DateUtils.format(startDay, DateUtils.DATE_PATTERN));
startDay = DateUtils.addDateDays(startDay, 1);
}
ArrayList<Map<String, Object>> resultMap = new ArrayList<>();
for (String s : dayList) {
HashMap<String, Object> dayMap = new HashMap<>();
dayMap.put(s, 0);
for (Map map : maps) {
if (s.equals(map.get("date"))) {
dayMap.put(s, map.get("count"));
}
}
resultMap.add(dayMap);
}
return resultMap;
}
@Override
public Object selectDayAvg() {
Date startDay = DateUtils.stringToDate(systemDay, DateUtils.DATE_PATTERN);
Date today = new Date();
Long days = (today.getTime() - startDay.getTime()) / (1000 * 60 * 60 * 24);
return resourceDao.selectDayAvg(days);
}
@Override
public Object selectDayMax() {
return resourceDao.selectDayMax();
}
private List<Long> getSourceIdsByProcess(List<HistoricProcessInstance> list) {
List<Long> resourceIds = new ArrayList<>();
for (HistoricProcessInstance his : list) {

View File

@ -24,6 +24,8 @@ public class TResourceMountApplyServiceImpl extends CrudServiceImpl<TResourceMou
QueryWrapper<TResourceMountApplyEntity> wrapper = new QueryWrapper<>();
if (params.containsKey("creator")) { //查该用户创建的资源
wrapper.eq("creator", Long.valueOf(params.get("creator").toString()));
}else if(params.containsKey("resource_id")){
wrapper.eq("resource_id", Long.valueOf(params.get("resource_id").toString()));
}
return wrapper;

View File

@ -38,10 +38,12 @@
count(id) AS "count"
FROM t_demand_data
WHERE 1=1
AND apply_user_dept_id in
<foreach item="deptId" collection="list" open="(" separator="," close=")">
#{deptId}
</foreach>
<if test="null != list">
AND apply_user_dept_id in
<foreach item="deptId" collection="list" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
GROUP BY flag
ORDER BY flag
</select>

View File

@ -419,6 +419,7 @@
tb_data_resource tdr
WHERE
1 = 1
AND tdr.del_flag = 0
<if test="dto.name != null and dto.name != ''">
AND MATCH (tdr.name) AGAINST ( #{dto.name} IN BOOLEAN MODE)
</if>
@ -1057,8 +1058,9 @@
SUBSTRING_INDEX( SUBSTRING_INDEX( tdav.attr_value, ';', b.help_topic_id + 1 ), ';',- 1 ) AS type ,
COUNT( tdav.data_resource_id ) AS total
FROM
(select a.* from tb_data_attr a inner join tb_data_resource c on a.data_resource_id = c.id where c.type =
#{resourceType} AND c.dept_id = #{id} ) tdav
(SELECT a.* FROM tb_data_attr a INNER JOIN tb_data_resource c ON a.data_resource_id = c.id
INNER JOIN sys_dept b ON c.dept_id = b.id WHERE c.type =
#{resourceType} AND (b.id = #{id} OR INSTR(b.pids,#{id})) ) tdav
JOIN mysql.help_topic b ON b.help_topic_id &lt; ( LENGTH( tdav.attr_value ) - LENGTH( REPLACE ( tdav.attr_value,
';', '' ) ) + 1 )
WHERE
@ -1161,10 +1163,12 @@
tb_data_resource b
ON
a.resource_id = b.id
INNER JOIN sys_dept c
ON b.dept_id = c.id
WHERE
a.del_flag = 0
a.del_flag = 0 AND b.del_flag = 0
<if test="id != null and id != ''">
and b.dept_id = #{id}
and (c.id= #{id} OR INSTR(c.pids,#{id}))
</if>
<if test="resourceType != null and resourceType != ''">
AND b.type = #{resourceType}
@ -1179,10 +1183,12 @@
tb_data_resource b
ON
a.resource_id = b.id
INNER JOIN sys_dept c
ON b.dept_id = c.id
WHERE
a.del_flag = 0
a.del_flag = 0 AND b.del_flag = 0
<if test="id != null and id != ''">
and b.dept_id = #{id}
and (c.id = #{id} OR INSTR(c.pids,#{id}))
</if>
<if test="resourceType != null and resourceType != ''">
AND b.type = #{resourceType}
@ -1196,10 +1202,12 @@
tb_data_resource b
ON
a.resource_id = b.id
INNER JOIN sys_dept c
ON b.dept_id = c.id
WHERE
a.state = 0
a.state = 0 AND b.del_flag = 0
<if test="id != null and id != ''">
and b.dept_id = #{id}
and (c.id = #{id} OR INSTR(c.pids,#{id}))
</if>
<if test="resourceType != null and resourceType != ''">
AND b.type = #{resourceType}
@ -1213,32 +1221,35 @@
tb_data_resource b
ON
a.reference_id = b.id
INNER JOIN sys_dept c
ON b.dept_id = c.id
WHERE
a.del_flag = 0
a.del_flag = 0 AND b.del_flag = 0
<if test="id != null and id != ''">
and b.dept_id = #{id}
and (c.id = #{id} OR INSTR(c.pids,#{id}))
</if>
<if test="resourceType != null and resourceType != ''">
AND b.type = #{resourceType}
</if>
</select>
<select id="selectResourceShare" parameterType="java.util.Map" resultType="integer">
SELECT COUNT(id) AS nums
SELECT COUNT(a.id) AS nums
FROM
tb_data_resource
tb_data_resource a
INNER JOIN sys_dept b
ON a.dept_id = b.id
WHERE
del_flag = 0
a.del_flag = 0
<if test="id != null and id != ''">
and
dept_id = #{id}
and (b.id = #{id} OR INSTR(b.pids,#{id})
</if>
<if test="resourceType != null and resourceType != ''">
AND
type = #{resourceType}
a.type = #{resourceType}
</if>
<if test="shareCondition != null and shareCondition != ''">
AND
share_condition = #{shareCondition}
a.share_condition = #{shareCondition}
</if>
</select>
@ -1299,10 +1310,12 @@
FROM tb_data_resource
WHERE 1=1
AND del_flag = 0
AND dept_id in
<foreach item="deptId" collection="list" open="(" separator="," close=")">
#{deptId}
</foreach>
<if test="null != list">
AND dept_id in
<foreach item="deptId" collection="list" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
GROUP BY type
ORDER BY type
</select>
@ -1325,13 +1338,56 @@
<select id="selectDeptResourceByApplyNum" resultType="java.util.Map">
SELECT count(trma.id) as count, tdr.name
FROM tb_data_resource tdr left join t_resource_mount_apply trma on tdr.id=trma.resource_id
where tdr.dept_id in
<foreach item="deptId" collection="list" open="(" separator="," close=")">
#{deptId}
</foreach>
<if test="null != list">
where tdr.dept_id in
<foreach item="deptId" collection="list" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
group by tdr.id order by count desc
</select>
<select id="trafficDeptResource" resultType="java.util.Map">
SELECT
SUBSTR(create_date, 1, 10) AS "date",
COUNT( id ) AS "count"
FROM
tb_data_resource tdr
WHERE
1 = 1
AND del_flag = 0
<if test="null != deptIds">
AND tdr.dept_id IN
<foreach item="deptId" collection="deptIds" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
AND SUBSTR(create_date, 1, 10) BETWEEN #{startDate} AND #{endDate}
GROUP BY
SUBSTR(create_date, 1, 10)
</select>
<select id="selectDayAvg" resultType="java.lang.Long">
SELECT IFNULL(COUNT(id), 0) / ${days}
FROM tb_data_resource
WHERE 1 = 1
AND del_flag=0
</select>
<select id="selectDayMax" resultType="java.lang.Integer">
SELECT IFNULL(MAX(count), 0)
FROM
(SELECT
COUNT( id ) AS "count"
FROM
tb_data_resource
WHERE
1 = 1
AND del_flag = 0
GROUP BY
SUBSTR(create_date, 1, 10)) temp
</select>
<select id="selectCameraDTOById" resultMap="resourceDTO">
SELECT tdr.*, tda.* FROM tb_data_resource tdr, tb_data_attr tda WHERE tdr.id = tda.data_resource_id AND tdr.del_flag = 0 AND tdr.id = #{id}
</select>