Commit 038c656e by jiang'yun

修改问题

parent 95b5ea69
...@@ -2,6 +2,8 @@ package com.qianhe.controller; ...@@ -2,6 +2,8 @@ package com.qianhe.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.qianhe.domain.Vo.JcdwxxVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -127,4 +129,30 @@ public class SjBzxxController extends BaseController ...@@ -127,4 +129,30 @@ public class SjBzxxController extends BaseController
return list; return list;
} }
/**
* 基层单位信息统计
* @return
*/
@GetMapping("/jcdwtjList")
public TableDataInfo jcdwtjList(JcdwxxVo jcdwxxVo)
{
startPage();
List<JcdwxxVo> list = sjBzxxService.jcdwtjList(jcdwxxVo);
return getDataTable( list);
}
/**
* 导出班组信息列表
*/
@Log(title = "班组信息", businessType = BusinessType.EXPORT)
@PostMapping("/exporJcdw")
public void exporJcdw(HttpServletResponse response, JcdwxxVo jcdwxxVo)
{
List<JcdwxxVo> list = sjBzxxService.jcdwtjList(jcdwxxVo);
ExcelUtil<JcdwxxVo> util = new ExcelUtil<JcdwxxVo>(JcdwxxVo.class);
util.exportExcel(response, list, "班组信息数据");
}
} }
package com.qianhe.domain.Vo;
import com.qianhe.common.annotation.Excel;
import com.qianhe.common.core.domain.BaseEntity;
import lombok.Data;
@Data
public class JcdwxxVo extends BaseEntity {
private Long deptId;
/**
* 直属单位ID
*/
private Long zsdwid;
/**
* 直属单位名称
*/
@Excel(name = "直属单位")
private String zsdwmc;
/**
* 直属单位祖先路径
*/
private String zsdwAncestors;
/**
* 直属单位排序号
*/
private Integer zsdwpx;
/**
* 直属单位类型
*/
@Excel(name = "直属单位类型")
private String zsdwlx;
/**
* 直属单位基层单位总人数
*/
@Excel(name = "用工人数")
private Integer zsdwrs;
/**
* 基层单位ID
*/
private Long jcdwid;
/**
* 基层单位父ID(关联直属单位ID)
*/
private Long parentId;
/**
* 基层单位名称
*/
@Excel(name = "基层单位")
private String jcdwmc;
/**
* 基层单位祖先路径
*/
private String jcdwAncestors;
/**
* 基层单位排序号
*/
private Integer jcdwpx;
/**
* 基层单位类型
*/
@Excel(name = "基层单位类型")
private String jcdwlx;
/**
* 基层单位班组总人数
*/
@Excel(name = "用工人数")
private Integer jcdwrs;
/**
* 班组信息ID
*/
private Long bzid;
/**
* 班组名称
*/
@Excel(name = "班组名称")
private String bzmc;
/**
* 班组类型
*/
@Excel(name = "班组类型")
private String bzlx;
/**
* 班组人数
*/
@Excel(name = "班组人数")
private Integer bzrs;
}
...@@ -2,6 +2,7 @@ package com.qianhe.mapper; ...@@ -2,6 +2,7 @@ package com.qianhe.mapper;
import java.util.List; import java.util.List;
import com.qianhe.domain.SjBzxx; import com.qianhe.domain.SjBzxx;
import com.qianhe.domain.Vo.JcdwxxVo;
/** /**
* 班组信息Mapper接口 * 班组信息Mapper接口
...@@ -62,4 +63,7 @@ public interface SjBzxxMapper ...@@ -62,4 +63,7 @@ public interface SjBzxxMapper
public SjBzxx selectBzxxTj(SjBzxx sjBzxx); public SjBzxx selectBzxxTj(SjBzxx sjBzxx);
List<JcdwxxVo> jcdwtjList(JcdwxxVo jcdwxxVo);
} }
...@@ -2,6 +2,7 @@ package com.qianhe.service; ...@@ -2,6 +2,7 @@ package com.qianhe.service;
import java.util.List; import java.util.List;
import com.qianhe.domain.SjBzxx; import com.qianhe.domain.SjBzxx;
import com.qianhe.domain.Vo.JcdwxxVo;
/** /**
* 班组信息Service接口 * 班组信息Service接口
...@@ -61,4 +62,7 @@ public interface ISjBzxxService ...@@ -61,4 +62,7 @@ public interface ISjBzxxService
*/ */
public int deleteSjBzxxById(Long id); public int deleteSjBzxxById(Long id);
public int pltj(SjBzxx sjBzxx); public int pltj(SjBzxx sjBzxx);
List<JcdwxxVo> jcdwtjList(JcdwxxVo jcdwxxVo);
} }
...@@ -9,6 +9,7 @@ import com.qianhe.common.core.domain.entity.SysDept; ...@@ -9,6 +9,7 @@ import com.qianhe.common.core.domain.entity.SysDept;
import com.qianhe.common.utils.DateUtils; import com.qianhe.common.utils.DateUtils;
import com.qianhe.common.utils.SecurityUtils; import com.qianhe.common.utils.SecurityUtils;
import com.qianhe.common.utils.StringUtils; import com.qianhe.common.utils.StringUtils;
import com.qianhe.domain.Vo.JcdwxxVo;
import com.qianhe.system.domain.SysDeptCb; import com.qianhe.system.domain.SysDeptCb;
import com.qianhe.system.mapper.SysDeptMapper; import com.qianhe.system.mapper.SysDeptMapper;
import com.qianhe.system.service.ISysDeptCbService; import com.qianhe.system.service.ISysDeptCbService;
...@@ -129,6 +130,23 @@ public class SjBzxxServiceImpl implements ISjBzxxService ...@@ -129,6 +130,23 @@ public class SjBzxxServiceImpl implements ISjBzxxService
return sjBzxxMapper.plxg(sjBzxx); return sjBzxxMapper.plxg(sjBzxx);
} }
@Override
@DataScope(deptAlias = "a")
public List<JcdwxxVo> jcdwtjList(JcdwxxVo jcdwxxVo) {
if(jcdwxxVo.getDeptId()!=null){
SysDept dept = sysDeptMapper.selectDeptById(jcdwxxVo.getDeptId());
if(dept!=null){
if(dept.getDwjb().equals("3")){
jcdwxxVo.setZsdwid(dept.getDeptId());
}else if(dept.getDwjb().equals("4")){
jcdwxxVo.setJcdwid(dept.getDeptId());
}
}
}
List<JcdwxxVo> list =sjBzxxMapper.jcdwtjList(jcdwxxVo);
return list;
}
/** 查询统计 单位班组人数统计信息 */ /** 查询统计 单位班组人数统计信息 */
......
...@@ -114,6 +114,85 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -114,6 +114,85 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
${params.dataScope} ${params.dataScope}
limit 1 limit 1
</select> </select>
<select id="jcdwtjList" resultType="com.qianhe.domain.Vo.JcdwxxVo">
SELECT
t.*,
b.jcdwrs,
s.zsdwrs
FROM (
-- 原查询结果作为基础表t
select
a.dept_id zsdwid,a.dept_name zsdwmc,a.ancestors zsdw_ancestors,a.order_num zsdwpx,b.dwlx zsdwlx,
b.dept_id jcdwid,b.parent_id,b.dept_name jcdwmc,b.ancestors jcdw_ancestors,b.order_num jcdwpx,b.dwlx jcdwlx,
b.bzid,b.bzmc,b.bzlx,case when b.bzrs is null then a.jcrysl else bzrs end bzrs,a.jcrysl zsdwrysl,b.jcrysl
jcdwyrsl
from (
select a.dept_id,a.dept_name,a.ancestors,a.order_num,b.dwlx,b.jcrysl
from sys_dept a
left join sys_dept_cb b on a.dept_id=b.dept_id
where dwjb='3'
and status='0'
and del_flag='0'
<!-- 数据范围过滤 -->
${params.dataScope}
order by order_num
)a
left join (
select a.dept_id,a.parent_id,a.dept_name,a.ancestors,a.order_num,b.dwlx,c.id bzid,c.bzmc,c.bzlx,c.rs
bzrs,b.jcrysl
from sys_dept a
left join sys_dept_cb b on a.dept_id=b.dept_id
left join sj_bzxx c on a.dept_id=c.dept_id
where dwjb='4'
and status='0'
and del_flag='0'
order by order_num
) b on a.dept_id=b.parent_id
) t
-- 关联计算jcdwrs(同一jcdwid的bzrs总和)
LEFT JOIN (
select
dept_id jcdwid,
SUM(bzrs) jcdwrs
from (
select a.dept_id,c.rs bzrs
from sys_dept a
left join sj_bzxx c on a.dept_id=c.dept_id
where dwjb='4'
and status='0'
and del_flag='0'
) temp
group by dept_id
) b ON t.jcdwid = b.jcdwid
-- 关联计算zsdwrs(同一zsdwid的jcdwrs总和)
LEFT JOIN (
select
parent_id zsdwid,
SUM(jcdwrs) zsdwrs
from (
select
a.parent_id,
SUM(c.rs) jcdwrs
from sys_dept a
left join sj_bzxx c on a.dept_id=c.dept_id
where dwjb='4'
and status='0'
and del_flag='0'
group by a.dept_id,a.parent_id
) temp
group by parent_id
) s ON t.zsdwid = s.zsdwid
where 1=1
<if test="zsdwlx != null and zsdwlx != ''">and t.zsdwlx = #{zsdwlx}</if>
<if test="jcdwlx != null and jcdwlx != ''">and t.jcdwlx = #{jcdwlx}</if>
<if test="bzlx != null and bzlx != ''">and t.bzlx = #{bzlx}</if>
<if test="zsdwid != null">and (t.zsdwid=#{zsdwid} or find_in_set(#{zsdwid},t.zsdw_ancestors))</if>
<if test="jcdwid != null">and (t.jcdwid=#{jcdwid} or find_in_set(#{jcdwid},t.jcdw_ancestors))</if>
order by t.zsdwpx,t.jcdwpx
</select>
<update id="plxg" parameterType="SjBzxx"> <update id="plxg" parameterType="SjBzxx">
update sj_bzxx update sj_bzxx
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment