新增工作动态,门户搜索修改

This commit is contained in:
dinggang 2022-05-11 20:19:31 +08:00
parent 20d8ceb860
commit ba2cf96791
16 changed files with 237 additions and 113 deletions

View File

@ -111,6 +111,13 @@ public class ResourceController {
return new Result<>().ok(resourceService.selectRecommend());
}
@PostMapping("/selectDeptList")
@ApiOperation("查询部门企业列表及汇聚能力数量")
@LogOperation("查询部门企业列表及汇聚能力数量")
public Result selectDeptList(@RequestBody JSONObject jsonObject) {
return new Result().ok(resourceService.selectDeptList(jsonObject));
}
@GetMapping("/updateVisits")
@ApiOperation("更新能力访问量")
@LogOperation("更新能力访问量")
@ -156,9 +163,7 @@ public class ResourceController {
@LogOperation("删除")
//@RequiresPermissions("resource:resource:delete")
public Result delete(@RequestBody JSONObject jsonObject) {
resourceService.deleteWithAttrs(jsonObject);
return new Result();
}

View File

@ -52,4 +52,8 @@ public interface ResourceDao extends BaseDao<ResourceEntity> {
* @return
*/
Long countAllDept();
List<Map<String, Object>> selectGroupByDeptId();
Integer selectTypeCountByDept(String type);
}

View File

@ -12,7 +12,7 @@ import java.util.Map;
/**
* 资源表
*
* @author dg
* @author dg
* @since 1.0 2022-04-13
*/
public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO> {
@ -39,6 +39,7 @@ public interface ResourceService extends CrudService<ResourceEntity, ResourceDTO
Object selectRecommend();
Object selectDeptList(JSONObject jsonObject);
List<Map<String, Object>> getAmountGroupByType();
Long countAllDept();

View File

@ -31,6 +31,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 资源表
@ -221,7 +222,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<ResourceDTO> resourceDTOS = resourceDao.selectMostPopular(selectMap);
page.setRecords(resourceDTOS);
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag()).eq("type", jsonObject.getString("type"));
queryWrapper.eq("del_flag", ResourceEntityDelFlag.NORMAL.getFlag())
.eq("type", jsonObject.getString("type"));
Integer count = resourceDao.selectCount(queryWrapper);
page.setTotal(count);
return page;
@ -248,8 +250,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
//没有收藏和申请过按最热能力选取,否则根据应用领域最多类型推荐
if (applyAreaList.isEmpty()) {
JSONObject object = new JSONObject();
object.put("pageNum", 1);
object.put("pageSize", 6);
object.put("pageNum", 0);
object.put("pageSize", 9);
object.put("orderFiled", "total");
object.put("orderType", "DESC");
return this.selectMostPopular(object);
} else {
ResourceDTO resourceDTO = new ResourceDTO();
@ -261,7 +265,9 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
resourceDTO.setInfoList(list);
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(resourceDTO));
jsonObject.put("pageNum", 1);
jsonObject.put("pageSize", 6);
jsonObject.put("pageSize", 9);
jsonObject.put("orderField", "total");
jsonObject.put("orderType", "DESC");
return this.pageWithAttrs(jsonObject);
}
}
@ -276,4 +282,27 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public Long countAllDept() {
return baseDao.countAllDept();
}
@Override
public Object selectDeptList(JSONObject jsonObject) {
ArrayList<Map> resultList = new ArrayList<>();
HashMap<String, Object> resourceMap = new HashMap<>();
resourceMap.put("type", "全部能力目录");
QueryWrapper<ResourceEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("del_flag", 0);
resourceMap.put("total", resourceDao.selectCount(queryWrapper));
//resourceMap.put("dataList", resourceDao.selectList(queryWrapper));
resultList.add(resourceMap);
List<Map<String, Object>> typeMapList = resourceDao.selectGroupByDeptId();
Map<String, List<Map<String, Object>>> listMap = typeMapList.stream()
.collect(Collectors.groupingBy(m -> m.get("type").toString()));
listMap.entrySet().stream().forEach(item -> {
HashMap<Object, Object> map = new HashMap<>();
map.put("type", item.getKey());
map.put("total", resourceDao.selectTypeCountByDept(item.getKey()));
map.put("dataList", item.getValue());
resultList.add(map);
});
return resultList;
}
}

View File

@ -37,6 +37,12 @@ public class SysDeptDTO extends TreeNode implements Serializable {
@NotBlank(message="{sysdept.name.require}", groups = DefaultGroup.class)
private String name;
@ApiModelProperty(value = "类型1省级部门2市级部门3区级部门4企业")
private Integer type;
@ApiModelProperty(value = "")
private Long district;
@ApiModelProperty(value = "排序")
@Min(value = 0, message = "{sort.number}", groups = DefaultGroup.class)
private Integer sort;
@ -76,6 +82,22 @@ public class SysDeptDTO extends TreeNode implements Serializable {
this.name = name;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Long getDistrict() {
return district;
}
public void setDistrict(Long district) {
this.district = district;
}
public Integer getSort() {
return sort;
}

View File

@ -29,6 +29,14 @@ public class SysDeptEntity extends BaseEntity {
* 部门名称
*/
private String name;
/**
* 类型1省级部门2市级部门3区级部门4企业
*/
private Integer type;
/**
* 地区
*/
private Long district;
/**
* 排序
*/

View File

@ -17,7 +17,6 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@ -26,7 +25,6 @@ import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 工作动态
*
@ -34,13 +32,13 @@ import java.util.Map;
* @since 1.0 2022-05-06
*/
@RestController
@RequestMapping("workDynamics/workdynamics")
@RequestMapping("/workdynamics")
@Api(tags="工作动态")
public class WorkDynamicsController {
@Autowired
private WorkDynamicsService workDynamicsService;
@GetMapping("page")
@GetMapping("/page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ -55,7 +53,7 @@ public class WorkDynamicsController {
return new Result<PageData<WorkDynamicsDTO>>().ok(page);
}
@GetMapping("{id}")
@GetMapping("/select/{id}")
@ApiOperation("信息")
//@RequiresPermissions("workDynamics:workdynamics:info")
public Result<WorkDynamicsDTO> get(@PathVariable("id") Long id){
@ -64,7 +62,7 @@ public class WorkDynamicsController {
return new Result<WorkDynamicsDTO>().ok(data);
}
@PostMapping
@PostMapping("/insert")
@ApiOperation("保存")
@LogOperation("保存")
//@RequiresPermissions("workDynamics:workdynamics:save")
@ -77,7 +75,7 @@ public class WorkDynamicsController {
return new Result();
}
@PutMapping
@PutMapping("/update")
@ApiOperation("修改")
@LogOperation("修改")
//@RequiresPermissions("workDynamics:workdynamics:update")
@ -90,7 +88,7 @@ public class WorkDynamicsController {
return new Result();
}
@DeleteMapping
@DeleteMapping("/delete")
@ApiOperation("删除")
@LogOperation("删除")
//@RequiresPermissions("workDynamics:workdynamics:delete")
@ -98,12 +96,12 @@ public class WorkDynamicsController {
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
workDynamicsService.delete(ids);
workDynamicsService.deleteByIds(ids);
return new Result();
}
@GetMapping("export")
@GetMapping("/export")
@ApiOperation("导出")
@LogOperation("导出")
//@RequiresPermissions("workDynamics:workdynamics:export")

View File

@ -3,6 +3,7 @@ package io.renren.modules.workDynamics.dao;
import io.renren.common.dao.BaseDao;
import io.renren.modules.workDynamics.entity.WorkDynamicsEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 工作动态
@ -12,5 +13,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface WorkDynamicsDao extends BaseDao<WorkDynamicsEntity> {
Integer deleteByIds(@Param("ids") Long[] ids);
}

View File

@ -24,10 +24,10 @@ public class WorkDynamicsDTO implements Serializable {
private String title;
@ApiModelProperty(value = "导航图保存地址")
private String imageUrl;
@ApiModelProperty(value = "文件地址")
private String fileUrl;
@ApiModelProperty(value = "内容")
private String content;
@ApiModelProperty(value = "删除标志0:正常1:删除9:其他")
private Integer delFalg;
private Integer delFlag;
@ApiModelProperty(value = "创建人")
private Long creator;
@ApiModelProperty(value = "创建时间")

View File

@ -31,13 +31,13 @@ public class WorkDynamicsEntity {
*/
private String imageUrl;
/**
* 文件地址
* 内容
*/
private String fileUrl;
private String content;
/**
* 删除标志0:正常1:删除9:其他
*/
private Integer delFalg;
private Integer delFlag;
/**
* 创建人
*/

View File

@ -27,7 +27,7 @@ public class WorkDynamicsExcel {
@ExcelProperty(value = "文件地址", index = 3)
private String fileUrl;
@ExcelProperty(value = "删除标志0:正常1:删除9:其他", index = 4)
private Integer delFalg;
private Integer delFlag;
@ExcelProperty(value = "创建人", index = 5)
private Long creator;
@ExcelProperty(value = "创建时间", index = 6)

View File

@ -12,4 +12,5 @@ import io.renren.modules.workDynamics.entity.WorkDynamicsEntity;
*/
public interface WorkDynamicsService extends CrudService<WorkDynamicsEntity, WorkDynamicsDTO> {
void deleteByIds(Long[] ids);
}

View File

@ -9,6 +9,7 @@ import io.renren.modules.workDynamics.entity.WorkDynamicsEntity;
import io.renren.modules.workDynamics.service.WorkDynamicsService;
import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
@ -22,13 +23,21 @@ import java.util.Map;
@Service
public class WorkDynamicsServiceImpl extends CrudServiceImpl<WorkDynamicsDao, WorkDynamicsEntity, WorkDynamicsDTO> implements WorkDynamicsService {
@Autowired
private WorkDynamicsDao workDynamicsDao;
@Override
public QueryWrapper<WorkDynamicsEntity> getWrapper(Map<String, Object> params){
QueryWrapper<WorkDynamicsEntity> wrapper = new QueryWrapper<>();
wrapper.eq("del_flag", 0)
.orderByDesc("create_date");
return wrapper;
}
@Override
public void deleteByIds(Long[] ids) {
workDynamicsDao.deleteByIds(ids);
}
}

View File

@ -5,7 +5,6 @@ spring:
druid:
#MySQL
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
password: Hisense2019

View File

@ -99,32 +99,31 @@
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(trc2.isCollect, 'false') AS "isCollect",
(IFNULL(tdr.visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(taa.applyCount, 0)+ IFNULL(trc.collectCount, 0)) AS
total
(IFNULL(tdr.visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(taa.applyCount, 0)+ IFNULL(trc.collectCount, 0)) AS total
FROM
tb_data_resource tdr
LEFT JOIN tb_data_attr tda ON tdr.id = tda.data_resource_id
LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP
BY resource_id ) trs ON tdr.id = trs.resource_id
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag =
0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
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
LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trs ON tdr.id = trs.resource_id
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
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
) 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}
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.type = #{dto.type}
AND tdr.type LIKE CONCAT('%',#{dto.type},'%')
AND tdr.del_flag = 0
<if test="dto.name != null and dto.name != ''">
AND tdr.name like CONCAT('%',#{dto.name},'%')
@ -172,60 +171,52 @@
<select id="selectMostPopular" resultType="io.renren.modules.resource.dto.ResourceDTO">
SELECT
tdr.*,
IFNULL(trs.score, 0 ) AS "score",
IFNULL(taa.applyCount, 0 ) AS "applyCount",
IFNULL(trc.collectCount, 0) AS "collectCount",
(IFNULL(visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(applyCount,0)+ IFNULL(collectCount,0)) AS total
tdr.*,
IFNULL(trs.score, 0 ) AS "score",
IFNULL(taa.applyCount, 0 ) AS "applyCount",
IFNULL(trc.collectCount, 0) AS "collectCount",
(IFNULL(visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(applyCount,0)+ IFNULL(collectCount,0)) AS total
FROM
tb_data_resource tdr
LEFT JOIN ( SELECT resource_id, SUM(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP
BY resource_id ) trs ON tdr.id = trs.resource_id
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag =
0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
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
tb_data_resource tdr
LEFT JOIN ( SELECT resource_id, SUM(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trs ON tdr.id = trs.resource_id
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
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
WHERE
1 = 1
AND tdr.del_flag = 0
<if test="type != null and type != ''">
AND tdr.type = #{type}
</if>
<if test="name != null and name != ''">
AND tdr.name LIKE CONCAT('%',#{name},'%')
</if>
1 = 1
AND tdr.del_flag = 0
<if test="type != null and type != ''">
AND tdr.type LIKE CONCAT('%',#{type},'%')
</if>
<if test="name != null and name != ''">
AND tdr.name LIKE CONCAT('%',#{name},'%')
</if>
ORDER BY ${orderFiled} ${orderType}
LIMIT ${pageNum}, ${pageSize}
</select>
<select id="selectDTOById" resultMap="resourceDTO">
SELECT
tdr.*,
tda.*,
IFNULL(trs.score, 0 ) AS "score",
IFNULL(taa.applyCount, 0 ) AS "applyCount",
IFNULL(trc.collectCount, 0) AS "collectCount",
sd.name as "deptName",
IFNULL(trc2.isCollect, 'false') AS "isCollect",
IFNULL(taa2.applyState, 'false') AS "applyState"
tdr.*,
tda.*,
IFNULL(trs.score, 0 ) AS "score",
IFNULL(taa.applyCount, 0 ) AS "applyCount",
IFNULL(trc.collectCount, 0) AS "collectCount",
sd.name as "deptName",
IFNULL(trc2.isCollect, 'false') AS "isCollect",
IFNULL(taa2.approve_status, '未申请') AS "applyState"
FROM
tb_data_resource tdr
LEFT JOIN tb_data_attr tda ON tdr.id = tda.data_resource_id
LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP
BY resource_id ) trs ON tdr.id = trs.resource_id
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag =
0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
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 = #{userId}
GROUP BY resource_id) trc2 ON tdr.id = trc2.resource_id
LEFT JOIN ( SELECT resource_id, user_id, ( CASE approve_status WHEN '通过' THEN 'true' ELSE 'false' END ) AS
"applyState" FROM t_ability_application WHERE
1 = 1 AND del_flag = 0 AND user_id = #{userId}
GROUP BY id) taa2 ON tdr.id = taa2.resource_id
LEFT JOIN sys_dept sd ON tdr.dept_id = sd.id
tb_data_resource tdr
LEFT JOIN tb_data_attr tda ON tdr.id = tda.data_resource_id
LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trs ON tdr.id = trs.resource_id
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
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 = #{userId}
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 = #{userId}
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}
@ -233,42 +224,40 @@
<select id="selectDTOPage" resultType="io.renren.modules.resource.dto.ResourceDTO">
SELECT
tdr.*,
IFNULL(trs.score, 0 ) AS "score",
IFNULL(taa.applyCount, 0 ) AS "applyCount",
IFNULL(trc.collectCount, 0) AS "collectCount",
sd.name AS "deptName",
IFNULL(trc2.isCollect, 'false') AS "isCollect",
IFNULL(taa2.applyState, 'false') AS "applyState",
(IFNULL(visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(applyCount,0)+ IFNULL(collectCount,0)) AS total
tdr.*,
IFNULL(trs.score, 0 ) AS "score",
IFNULL(taa.applyCount, 0 ) AS "applyCount",
IFNULL(trc.collectCount, 0) AS "collectCount",
sd.name AS "deptName",
IFNULL(trc2.isCollect, 'false') AS "isCollect",
IFNULL(taa2.approve_status, '未申请') AS "applyState",
(IFNULL(visits / 100, 0) + IFNULL(trs.score, 0) + IFNULL(applyCount,0)+ IFNULL(collectCount,0)) AS total
FROM
tb_data_resource tdr
LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP
BY resource_id ) trs ON tdr.id = trs.resource_id
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag =
0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
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) trc2 ON tdr.id = trc2.resource_id
LEFT JOIN ( SELECT resource_id, user_id, ( CASE approve_status WHEN '通过' THEN 'true' ELSE 'false' END ) AS
"applyState" 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
tb_data_resource tdr
LEFT JOIN ( SELECT resource_id, AVG(score) AS "score" FROM tb_resource_score WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) trs ON tdr.id = trs.resource_id
LEFT JOIN ( SELECT resource_id, COUNT(id) AS "applyCount" FROM t_ability_application WHERE 1 = 1 AND del_flag = 0 GROUP BY resource_id ) taa ON tdr.id = taa.resource_id
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) 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}
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.name != null and dto.name != ''">
AND tdr.del_flag = 0
<if test="dto.name != null and dto.name != ''" >
AND tdr.name LIKE CONCAT('%',#{dto.name},'%')
</if>
<if test="dto.type != null and dto.type != ''">
<if test="dto.type != null and dto.type != ''" >
AND tdr.type = #{dto.type}
</if>
<if test="dto.districtId != null and dto.districtId != ''">
<if test="dto.districtId != null and dto.districtId != ''" >
AND tdr.district_id = #{dto.districtId}
</if>
<if test="dto.deptId != null and dto.deptId != ''" >
AND tdr.dept_id = #{dto.deptId}
</if>
ORDER BY ${orderField} ${orderType}
LIMIT ${pageNum}, ${pageSize}
</select>
@ -326,4 +315,50 @@
WHERE
del_flag = 0
</select>
<select id="selectGroupByDeptId" resultType="java.util.Map">
SELECT
*
FROM
(
SELECT
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
sd.NAME AS "deptName",
IFNULL( tdr.deptCount, 0 ) AS "deptCount",
sd.id AS "deptId"
FROM
sys_dept sd
LEFT JOIN ( SELECT dept_id, COUNT( id ) AS "deptCount" FROM tb_data_resource WHERE 1 = 1 AND del_flag = 0 GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id
) temp1
WHERE
1 = 1
AND temp1.deptCount != 0
</select>
<select id="selectTypeCountByDept" resultType="java.lang.Integer">
SELECT
SUM( deptCount )
FROM
(
SELECT
*
FROM
(
SELECT
( CASE sd.type WHEN 1 THEN '省级' WHEN 2 THEN '市级' WHEN 3 THEN '区级' WHEN 4 THEN '企业' ELSE '其他' END ) AS "type",
sd.NAME AS "deptName",
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 = 0 GROUP BY dept_id ) tdr ON sd.id = tdr.dept_id
) temp1
WHERE
1 = 1
AND temp1.deptCount != 0
) temp2
WHERE 1 = 1
AND temp2.type = #{type}
GROUP BY
temp2.type
</select>
</mapper>

View File

@ -7,8 +7,8 @@
<result property="id" column="id"/>
<result property="title" column="title"/>
<result property="imageUrl" column="image_url"/>
<result property="fileUrl" column="file_url"/>
<result property="delFalg" column="del_falg"/>
<result property="content" column="content"/>
<result property="delFlag" column="del_flag"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
@ -20,4 +20,15 @@
<result property="note5" column="note5"/>
</resultMap>
<update id="deleteByIds">
update tb_work_dynamics
set del_flag = 1 ,
update_date = now()
where 1 = 1
and id in
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</update>
</mapper>