Merge remote-tracking branch 'origin/master'

This commit is contained in:
wangliwen 2022-06-02 16:56:43 +08:00
commit 54b395580b
16 changed files with 247 additions and 83 deletions

View File

@ -86,7 +86,6 @@ public class CensusController {
};
dbAmount.add(nullMap);
}
});
Long sum = dbAmount.stream().mapToLong(index -> Long.valueOf(index.get("amount").toString())).sum();
Map<String, Object> sumMap = new HashMap<String, Object>() {

View File

@ -1,5 +1,7 @@
package io.renren.modules.resource.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
@ -9,6 +11,7 @@ import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.modules.resource.dto.ResourceDTO;
import io.renren.modules.resource.entity.AttrEntity;
import io.renren.modules.resource.service.ResourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -17,11 +20,16 @@ import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import springfox.documentation.annotations.ApiIgnore;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -36,6 +44,36 @@ import java.util.Map;
@Api(tags = "资源表")
public class ResourceController {
@Value("${qdyjj.ipAndPort}")
private String ipAndPort;
@Value("${zsk.appid}")
private String appId;
@Value("${zsk.appkey}")
private String appKey;
@Value("${zsk.url.sign}")
private String sign;
@Value("${zsk.url.gateway}")
private String gateway;
@Value("${zsk.methodId}")
private String methodId;
@Value("${zsk.param.charset}")
private String charset;
@Value("${zsk.param.origin}")
private String origin;
@Value("${zsk.param.version}")
private String version;
@Value("${zsk.catalogIds}")
private String[] catalogIds;
@Autowired
private ResourceService resourceService;
@ -183,7 +221,6 @@ public class ResourceController {
" <soap:Body>\n" +
" </soap:Body>\n" +
"</soap:Envelope>";
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.set("SOAPAction", "http://tempuri.org/ZywMessagePort");
requestHeaders.setContentType(MediaType.TEXT_XML);
@ -195,11 +232,119 @@ public class ResourceController {
return new Result().ok(map);
} catch (Exception e) {
e.printStackTrace();
return new Result().error();
return new Result().ok(new HashMap<>());
}
}
@GetMapping("qdyjjWeather")
@ApiOperation("青岛应急局-查询青岛市地区天气信息")
public Result qdyjjWeather(String cityName){
String loginUrl = "http://" + ipAndPort + "/service-oauth/login";
String weatherUrl = "http://" + ipAndPort + "/service-map/qxWeather/getTodayWeatherInfo";
HashMap<String, Object> loginParam = new HashMap<>();
loginParam.put("loginName", "qdyjj");
loginParam.put("loginPassword", "i/NA1EJ70VaPP0mhFGyJsg==");
HttpEntity<String> loginRequestEntity = new HttpEntity(loginParam, new HttpHeaders());
try {
String loginBody = restTemplate.postForObject(loginUrl, loginRequestEntity, String.class);
JSONObject json = JSON.parseObject(loginBody);
String token = json.getString("data");
MultiValueMap<String, Object> weatherParam = new LinkedMultiValueMap<>();
weatherParam.add("cityName", cityName);
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.add("token", token);
HttpEntity<String> weatherRequestEntity = new HttpEntity(weatherParam, httpHeaders);
String weatherBody = restTemplate.postForEntity(weatherUrl, weatherRequestEntity, String.class).getBody();
return new Result().ok(weatherBody);
} catch (Exception e) {
e.printStackTrace();
return new Result().ok(new HashMap(){{
put("message", "接口调用失败!");
put("code", "500");
}});
}
}
@GetMapping("knowledgeBase")
@ApiOperation("对接知识库数据")
public void knowledgeBase(){
long timestamp = new Date().getTime();
MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<>();
paramMap.add("app_id",appId);
paramMap.add("interface_id", methodId);
paramMap.add("version", version);
paramMap.add("charset", charset);
paramMap.add("timestamp", String.valueOf(timestamp));
paramMap.add("origin", origin);
String bizContent;
for (String catalogId: catalogIds) {
bizContent = "{\"appkey\":\""+ appKey +"\",\n" +
"\"catalogId\":\""+ catalogId +"\",\n" +
"\"pageIndex\":1,\n" +
"\"pageSize\":1000}";
paramMap.add("biz_content", bizContent);
try {
String signResult = restTemplate.postForObject(sign, paramMap, String.class);
JSONObject signJsonObject = JSON.parseObject(signResult);
Map<String, Object> signData = (Map<String, Object>)signJsonObject.get("data");
String signString = signData.get("sign").toString();
paramMap.add("sign", signString);
String gatewayResult = restTemplate.postForObject(gateway, paramMap, String.class);
JSONObject gatewayJsonObject = JSON.parseObject(gatewayResult);
JSONObject gatewayData = JSON.parseObject(gatewayJsonObject.get("data").toString());
JSONArray infos = gatewayData.getJSONObject("data").getJSONArray("infos");
infos.forEach(item -> {
Map<String, Object> map = (Map<String, Object>) item;
ResourceDTO dto = new ResourceDTO();
dto.setName(map.get("title").toString());
dto.setType("知识库");
dto.setVisits(0L);
//所属部门暂时设为青岛市政府办公厅
dto.setDeptId(1517116100113850370L);
dto.setDelFlag(0);
ArrayList<AttrEntity> infoList = new ArrayList<>();
map.forEach((key, value) -> {
switch (key) {
case "title":
dto.setName(value.toString());
break;
case "url":
dto.setLink(value.toString());
break;
case "createtime":
Date createDate = new Date(Long.parseLong(value.toString()));
dto.setCreateDate(createDate);
break;
default:
AttrEntity attrEntity = new AttrEntity();
attrEntity.setDelFlag(0);
attrEntity.setAttrType(key);
attrEntity.setAttrValue(value.toString());
infoList.add(attrEntity);
break;
}
});
AttrEntity attrEntity = new AttrEntity();
attrEntity.setDelFlag(0);
attrEntity.setAttrType("文件类型");
if ("f49561afc7204f008c4bb3cd821eb6ba".equals(catalogId)) {
attrEntity.setAttrValue("政府公报");
} else {
attrEntity.setAttrValue("政策解读");
}
infoList.add(attrEntity);
dto.setInfoList(infoList);
resourceService.insertWithAttrs(dto);
});
} catch (Exception e) {
e.printStackTrace();
}
paramMap.remove("sign");
paramMap.remove("biz_content");
}
}
@GetMapping("algorithmPage")
@ApiOperation("算法仓分页查询")
@LogOperation("算法仓分页查询")
@ -225,4 +370,5 @@ public class ResourceController {
ExcelUtils.exportExcelToTarget(response, null, "资源表", list, ResourceExcel.class);
}
*/
}

View File

@ -23,9 +23,12 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
List<ResourceDTO> selectWithAttrs(@Param("dto") ResourceDTO resourceDTO,
@Param("orderField") String orderField,
@Param("orderType") String orderType);
@Param("orderType") String orderType,
@Param("pageNum") Integer pageNum,
@Param("pageSize") Integer pageSize
);
List<Map> selectTypeCount(Long deptId);
List<Map> selectTypeCount();
List<ResourceDTO> selectMostPopular(Map<String, Object> selectMap);

View File

@ -30,10 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -107,9 +104,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resourceEntity.setDelFlag(ResourceEntityDelFlag.NORMAL.getFlag());
}
resourceDao.insert(resourceEntity);
BeanUtils.copyProperties(resourceEntity, dto);
List<AttrEntity> attrEntities = dto.getInfoList();
if (attrEntities != null) {
attrEntities.forEach(item -> {
@ -177,13 +172,13 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
Page<ResourceDTO> resultPage = new Page<>(pageNum, pageSize);
if (resourceDTO.getInfoList().isEmpty()) {
List<ResourceDTO> resourceDTOS = resourceDao.selectDTOPage(resourceDTO, (pageNum - 1) * pageSize, pageSize, orderField, orderType);
resourceDTOS.forEach(item -> {
item.setInfoList(this.selectAttrsByResourceId(item.getId()));
});
//resourceDTOS.forEach(item -> {
// item.setInfoList(this.selectAttrsByResourceId(item.getId()));
//});
resultPage.setRecords(resourceDTOS);
resultPage.setTotal(resourceDao.selectDTOPage(resourceDTO, 0, 100000, orderField, orderType).size());
} else {
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType);
List<ResourceDTO> resourceDTOS = resourceDao.selectWithAttrs(resourceDTO, orderField, orderType, (pageNum - 1) * pageSize, pageSize);
int j = Math.min(pageNum * pageSize, resourceDTOS.size());
if (resourceDTOS.isEmpty()) {
resultPage.setRecords(null);
@ -211,12 +206,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@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);
resultMap.put("total", resourceDao.selectTypeCount());
return resultMap;
}
@ -225,11 +216,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public Object selectNewest(JSONObject jsonObject) {
IPage<ResourceEntity> page = new Page<>(jsonObject.getIntValue("pageNum"), jsonObject.getIntValue("pageSize"));
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.orderByDesc("create_date")
.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"))
.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag());
IPage<ResourceEntity> entityIPage = resourceDao.selectPage(page, queryWrapper);
return entityIPage;
queryWrapper.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"))
.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag())
.orderByDesc("create_date");
return resourceDao.selectPage(page, queryWrapper);
}
@ -326,11 +316,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
HashMap<String, Object> resourceMap = new HashMap<>();
resourceMap.put("type", "全部能力目录");
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in(true, "del_flag", 0, 5)
queryWrapper.eq("del_flag", 0)
.eq(StringUtils.isNotBlank(jsonObject.getString("type")), "type", jsonObject.getString("type"));
resourceMap.put("total", resourceDao.selectCount(queryWrapper));
resultList.add(resourceMap);
List<Map<String, Object>> typeMapList = resourceDao.selectGroupByDeptId(jsonObject.getString("type"));
if (typeMapList.isEmpty()) {
return resultList;
}
Map<String, List<Map<String, Object>>> listMap = typeMapList.stream()
.collect(Collectors.groupingBy(m -> m.get("type").toString()));
//区级要根据行政区划多加一层结构
@ -344,14 +337,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
map.put("dataList", item.getValue());
resultList.add(map);
});
List<Map<String, Object>> areaList = listMap.get("区级");
Map<String, List<Map<String, Object>>> areaTypeList = areaList.stream()
.collect(Collectors.groupingBy(m -> m.get("districtName").toString()));
Optional<List<Map<String, Object>>> areaList = Optional.ofNullable(listMap.get("区级"));
Optional<Map<String, List<Map<String, Object>>>> areaTypeList = Optional.ofNullable(areaList.orElse(new ArrayList<>()).stream()
.collect(Collectors.groupingBy(m -> m.get("districtName").toString())));
HashMap<Object, Object> areaMap = new HashMap<>();
areaMap.put("type", "区级");
areaMap.put("total", resourceDao.selectTypeCountByDept("区级", jsonObject.getString("type")));
ArrayList<Map> areaListTemp = new ArrayList<>();
areaTypeList.entrySet().stream().forEach(item -> {
areaTypeList.orElse(new HashMap<>()).entrySet().stream().forEach(item -> {
HashMap<String, Object> map = new HashMap<>();
map.put("type", item.getKey());
map.put("total", resourceDao.selectTypeCountByDist(item.getKey(), jsonObject.getString("type")));
@ -428,7 +421,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
@Override
public List<String> selectDeptProvide(Long deptId) {
return baseDao.selectDeptProvide(deptId);
}

View File

@ -67,13 +67,13 @@ public class ResourceCarServiceImpl extends CrudServiceImpl<ResourceCarDao, Reso
}else {
ResourceCarEntity entity = carEntities.get(0);
ResourceCarEntity carEntity = new ResourceCarEntity();
BeanUtils.copyProperties(entity, carEntity, "updateDate");
BeanUtils.copyProperties(entity, carEntity, "updateDate", "updater");
resourceCarDao.updateById(carEntity);
}
}
@Override
public IPage<ResourceCarDTO> selectPage(Map<String, Object> params) {
public Page<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());
@ -81,6 +81,7 @@ public class ResourceCarServiceImpl extends CrudServiceImpl<ResourceCarDao, Reso
params.put("userId", user.getId());
List<ResourceCarDTO> resourceCarDTOS = resourceCarDao.selectPageWithResource(params, (pageNum - 1) * pageSize, pageSize);
resourceCarDTOS.forEach(item -> {
//TODO:不需带attr属性数据
item.setResourceDTO(resourceService.selectWithAttrs(item.getResourceId()));
});
List<ResourceCarDTO> resourceCarDTOSs = resourceCarDao.selectPageWithResource(params, 0, 100000);

View File

@ -40,7 +40,7 @@ public class SysDeptDTO extends TreeNode implements Serializable {
@ApiModelProperty(value = "类型1省级部门2市级部门3区级部门4企业")
private Integer type;
@ApiModelProperty(value = "")
@ApiModelProperty(value = "地区")
private Long district;
@ApiModelProperty(value = "排序")

View File

@ -67,6 +67,8 @@ hisense:
gateway:
url: http://devtest-security-app.hismarttv.com:8080
qdyjj:
ipAndPort: 15.2.21.238:9015
##多数据源的配置需要引用renren-dynamic-datasource
#dynamic:

View File

@ -57,6 +57,9 @@ logging:
impl:
persistence:
entity: debug
qdyjj:
ipAndPort: 15.2.21.238:9015
mybatis-plus:
configuration:
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

View File

@ -5,12 +5,9 @@ spring:
druid:
#MySQL
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/shangtangapi?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
url: jdbc:mysql://127.0.0.1:3306/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
username: root
password: 123456
# driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://15.2.21.238:3310/share_platform?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&useSSL=false
# username: root
@ -57,3 +54,6 @@ big_date:
hisense:
gateway:
url: http://devtest-security-app.hismarttv.com:8080
qdyjj:
ipAndPort: 15.2.21.238:9015

View File

@ -47,4 +47,7 @@ big_date:
hisense:
gateway:
url: http://15.72.184.7:8080
url: http://devtest-security-app.hismarttv.com:8080
qdyjj:
ipAndPort: 15.2.21.238:9015

View File

@ -64,6 +64,9 @@ hisense:
gateway:
url: http://devtest-security-app.hismarttv.com:8080
qdyjj:
ipAndPort: 15.2.21.238:9015
##多数据源的配置需要引用renren-dynamic-datasource
#dynamic:

View File

@ -43,4 +43,7 @@ resource:
# 大数据部门相关配置
big_date:
name: 青岛市大数据发展管理局
assignee_role_name: 部门审批人
assignee_role_name: 部门审批人
qdyjj:
ipAndPort: 15.2.21.238:9015

View File

@ -83,4 +83,20 @@ mybatis-plus:
#系统上线日期,用于统计能力浏览记录
system:
startDay: 2022-04-01
startDay: 2022-04-01
#知识库
zsk:
url:
sign: https://cms.qingdao.gov.cn:9020/api-gateway/jpaas-jags-server/interface/createsign.do
gateway: https://cms.qingdao.gov.cn:9020/api-gateway/jpaas-jags-server/interface/gateway
appid: hxszzt
appkey: 120d6a3cc2cd45096abaa5700cb19d0779d5f22ff683436e6d3a7ff8a8d66f5e8307f31b192281831e9f6dc0b6a1f308
param:
charset: UTF-8
origin: 0
version: 1.0
methodId: jirdGetInfoByCatalog
catalogIds: c0645e03fb7e4cf3842e9ceedd8ab998,f49561afc7204f008c4bb3cd821eb6ba

View File

@ -24,6 +24,7 @@
WHERE
t1.id = #{businessKey}
</select>
<select id="countApplyAll" resultType="java.lang.Long">
SELECT
COUNT( id )
@ -32,6 +33,7 @@
WHERE
approve_status = '通过'
</select>
<select id="getAmountGroupByType" resultType="java.util.Map">
SELECT
tbr.type AS type,
@ -44,6 +46,7 @@
GROUP BY
tbr.type
</select>
<select id="selectDeptApplyCount" resultType="java.util.Map">
SELECT
COUNT(
@ -76,6 +79,7 @@
temp.dept_id
LIMIT #{n}
</select>
<select id="selectDeptApply" resultType="java.lang.String">
SELECT DISTINCT
( tda.attr_value )

View File

@ -104,12 +104,11 @@
<select id="selectWithAttrs" resultMap="resourceDTO">
SELECT
tdr.*,
tda.*,
IFNULL(taa2.approve_status, '未申请') AS "applyState",
IFNULL(trs.score, 0 ) AS "score",
IFNULL(taa.applyCount, 0 ) AS "applyCount",
IFNULL(trc.collectCount, 0) AS "collectCount",
IFNULL(sd.name, '暂无部门信息') AS "deptName",
IFNULL(sd.name, '暂无部门单位信息') AS "deptName",
IFNULL(trc2.isCollect, 'false') AS "isCollect",
(IFNULL(tdr.visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(taa.applyCount, 0)+ IFNULL(trc.collectCount, 0)) AS
total
@ -123,21 +122,16 @@
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag
= 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect"
FROM tb_resource_collection WHERE
1 = 1
AND del_flag = 0
AND user_id = #{dto.creator}
GROUP BY resource_id
FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator} GROUP BY resource_id
) trc2 ON tdr.id = trc2.resource_id
LEFT JOIN ( SELECT resource_id, user_id, approve_status FROM t_ability_application WHERE
1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
LEFT JOIN ( SELECT resource_id, user_id, approve_status FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
WHERE 1 = 1
AND tdr.del_flag = 0
<if test="dto.type != null and dto.type != ''">
AND tdr.type LIKE CONCAT('%',#{dto.type},'%')
</if>
AND tdr.del_flag = 0
<if test="dto.name != null and dto.name != ''">
AND tdr.name LIKE CONCAT('%',#{dto.name},'%')
</if>
@ -184,9 +178,6 @@
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>
@ -247,7 +238,6 @@
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
WHERE 1 = 1
<!-- AND tdr.del_flag = 0-->
AND tdr.id = #{id}
</select>
@ -270,11 +260,9 @@
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "collectCount" FROM tb_resource_collection WHERE 1 = 1 AND del_flag
= 0 GROUP BY resource_id ) trc ON tdr.id = trc.resource_id
LEFT JOIN ( SELECT resource_id, user_id, ( CASE COUNT( id ) WHEN 1 THEN 'true' ELSE 'false' END ) AS "isCollect"
FROM tb_resource_collection WHERE
1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
FROM tb_resource_collection WHERE 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
GROUP BY resource_id) trc2 ON tdr.id = trc2.resource_id
LEFT JOIN ( SELECT resource_id, approve_status FROM t_ability_application WHERE
1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
LEFT JOIN ( SELECT resource_id, approve_status FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 AND user_id = #{dto.creator}
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
WHERE 1 = 1
@ -323,7 +311,6 @@
LEFT JOIN t_ability_application taa ON tda.data_resource_id = taa.resource_id
AND taa.del_flag = 0
AND taa.user_id = #{userId}
WHERE
1 = 1
AND tda.attr_type = '应用领域'
@ -349,6 +336,7 @@
GROUP BY
type
</select>
<select id="countAllDept" resultType="java.lang.Long">
SELECT
COUNT( DISTINCT dept_id )
@ -372,7 +360,7 @@
sr.id AS "districtId"
FROM
sys_dept sd
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag IN (0 ,5)
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0
<if test="type != null and type != ''">
AND type = #{type}
</if>
@ -399,7 +387,7 @@
IFNULL( tdr.deptCount, 0 ) AS "deptCount"
FROM
sys_dept sd
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag IN (0, 5)
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0
<if test="resourceType != null and resourceType != ''">
AND type = #{resourceType}
</if>
@ -441,7 +429,7 @@
FROM
sys_dept sd
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource
WHERE 1 = 1 AND del_flag IN (0, 5)
WHERE 1 = 1 AND del_flag = 0
<if test="resourceType != null and resourceType != ''">
AND type = #{resourceType}
</if>
@ -457,9 +445,10 @@
GROUP BY
temp2.type
</select>
<select id="countAllVisits" resultType="java.lang.Long">
SELECT
COUNT( visits )
SUM( visits )
FROM
tb_data_resource
</select>

View File

@ -20,44 +20,44 @@
</resultMap>
<update id="deleteByIds">
update tb_resource_car
set del_flag = 1 ,
UPDATE tb_resource_car
SET del_flag = 1 ,
update_date = now()
where 1 = 1
and id in
WHERE 1 = 1
AND id IN
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</update>
<update id="delete4Resource">
update tb_resource_car
set del_flag = 1,
UPDATE tb_resource_car
SET del_flag = 1,
update_date = now()
where 1 = 1
and resource_id in
WHERE 1 = 1
AND resource_id IN
<foreach collection="resourceIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<select id="selectPageWithResource" resultType="io.renren.modules.resourceCar.dto.ResourceCarDTO">
select trc.*
from tb_resource_car trc
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 != 1
LEFT JOIN tb_data_resource tdr ON trc.resource_id = tdr.id AND tdr.del_flag != 1
</if>
where 1 = 1
and trc.del_flag = 0
and user_id = #{params.userId}
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},'%')
AND tdr.name LIKE CONCAT('%',#{params.name},'%')
</if>
<if test="params.type != null and params.type != ''">
and tdr.type = #{params.type}
AND tdr.type = #{params.type}
</if>
order by trc.update_date desc, trc.create_date desc
limit ${pageNum}, ${pageSize}
ORDER BY trc.update_date DESC, trc.create_date DESC
LIMIT ${pageNum}, ${pageSize}
</select>
</mapper>