견문 개인실적 통계 추가.

master
강석 최 2023-04-06 16:08:48 +09:00
parent b2f516ce1e
commit a3bf6ad82c
17 changed files with 1014 additions and 663 deletions

View File

@ -134,6 +134,7 @@ public class SecurityConfig{
"/equip/**",
"/affairPlan/**",
"/affair/**",
"/affairStatistics/**",
"/affairResult/**",
"/faStatistics/**",
"/translator/**",

View File

@ -4,7 +4,6 @@ import com.dbnt.faisp.main.authMgt.service.AuthMgtService;
import com.dbnt.faisp.main.codeMgt.model.CodeMgt;
import com.dbnt.faisp.main.fpiMgt.affair.model.AffairBoard;
import com.dbnt.faisp.main.fpiMgt.affair.model.AffairRating;
import com.dbnt.faisp.main.fpiMgt.affair.model.TypeStatistics;
import com.dbnt.faisp.main.fpiMgt.affair.service.AffairService;
import com.dbnt.faisp.main.organMgt.service.OrganConfigService;
import com.dbnt.faisp.main.userInfo.model.UserInfo;
@ -197,111 +196,4 @@ public class AffairController { // 첩보수집활동 > 외사경찰 견문관
mav.addObject("affairRating", affairService.getAffairRating(affairBoard, affairBoard.getWrtOrgan()));
return mav;
}
@GetMapping("/statistics")
public ModelAndView statistics(@AuthenticationPrincipal UserInfo loginUser, TypeStatistics typeStatistics){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/statistics/affairStatistics");
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
mav.addObject("searchParams", typeStatistics);
return mav;
}
@PostMapping("/fieldStatistics")
public ModelAndView fieldStatistics(TypeStatistics typeStatistics){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/statistics/fieldStatistics");
List<TypeStatistics> totalList = affairService.selectStatusTotal(typeStatistics);
List<TypeStatistics> type1List = affairService.selectType1ListCnt(typeStatistics);
List<TypeStatistics> type2List = affairService.selectType2ListCnt(typeStatistics);
List<TypeStatistics> type3List = affairService.selectType3ListCnt(typeStatistics);
List<TypeStatistics> type4List = affairService.selectType4ListCnt(typeStatistics);
if(!totalList.isEmpty()) {
TypeStatistics total = new TypeStatistics();
total.setItemValue("누계");
total.setWrtOrgan("total");
total.setCnt(0);
for(TypeStatistics stat: totalList) {
total.setCnt(total.getCnt()+stat.getCnt());
}
totalList.add(total);
}
mav.addObject("totalList", totalList);
if(typeStatistics.getCategory1() != null) {
addTotalRow(typeStatistics.getCategory1(), type1List);
}
if(typeStatistics.getCategory2() != null) {
addTotalRow(typeStatistics.getCategory2(), type2List);
}
if(typeStatistics.getCategory3() != null) {
addTotalRow(typeStatistics.getCategory3(), type3List);
}
if(typeStatistics.getCategory4() != null) {
addTotalRow(typeStatistics.getCategory4(), type4List);
}
mav.addObject("type1List", type1List);
mav.addObject("type2List", type2List);
mav.addObject("type3List", type3List);
mav.addObject("type4List", type4List);
mav.addObject("searchParams", typeStatistics);
return mav;
}
@PostMapping("/ratingStatistics")
public ModelAndView ratingStatistics(TypeStatistics typeStatistics){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/statistics/ratingStatistics");
List<TypeStatistics> totalList = affairService.selectRatingStatusTotal(typeStatistics);
List<TypeStatistics> sangboCntList = affairService.selectSangboTotal(typeStatistics);
List<TypeStatistics> arrCntList = affairService.selectArrCntList(typeStatistics);
if(!totalList.isEmpty()) {
TypeStatistics total = new TypeStatistics();
total.setItemValue("누계");
total.setWrtOrgan("total");
total.setCnt(0);
for(TypeStatistics stat: totalList) {
total.setCnt(total.getCnt()+stat.getCnt());
}
totalList.add(total);
}
if(typeStatistics.getSangbo() != null) {
addTotalRow(typeStatistics.getSangbo(), sangboCntList);
}
if(typeStatistics.getRating() != null) {
addTotalRow(typeStatistics.getRating(), arrCntList);
}
mav.addObject("totalList", totalList);
mav.addObject("sangboList", sangboCntList);
mav.addObject("arrCntList", arrCntList);
mav.addObject("searchParams", typeStatistics);
return mav;
}
@PostMapping("/personalStatistics")
public ModelAndView personalStatistics(TypeStatistics typeStatistics){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/statistics/personalStatistics");
List<TypeStatistics> totalList = affairService.selectPersonalStatusTotal(typeStatistics);
mav.addObject("totalList", totalList);
mav.addObject("searchParams", typeStatistics);
return mav;
}
private void addTotalRow(List<String> type, List<TypeStatistics> typeList){
Map<String, Integer> totalMap = new HashMap<>();
for(String t: type) {
totalMap.put(t, 0);
}
for(TypeStatistics t: typeList) {
totalMap.put(t.getAffairType(), totalMap.get(t.getAffairType())+t.getCnt());
}
for (String affairType : totalMap.keySet()) {
Integer cnt = totalMap.get(affairType);
TypeStatistics total = new TypeStatistics();
total.setWrtOrgan("total");
total.setAffairType(affairType);
total.setCnt(cnt);
typeList.add(total);
}
}
}

View File

@ -2,7 +2,6 @@ package com.dbnt.faisp.main.fpiMgt.affair.mapper;
import com.dbnt.faisp.main.fpiMgt.affair.model.AffairBoard;
import com.dbnt.faisp.main.fpiMgt.affair.model.DashboardAffair;
import com.dbnt.faisp.main.fpiMgt.affair.model.TypeStatistics;
import org.apache.ibatis.annotations.Mapper;
@ -18,23 +17,6 @@ public interface AffairMapper {
String selectHashTags(Integer affairKey);
List<TypeStatistics> selectStatusTotal(TypeStatistics typeStatistics);
List<TypeStatistics> selectType1ListCnt(TypeStatistics typeStatistics);
List<TypeStatistics> selectType2ListCnt(TypeStatistics typeStatistics);
List<TypeStatistics> selectType3ListCnt(TypeStatistics typeStatistics);
List<TypeStatistics> selectType4ListCnt(TypeStatistics typeStatistics);
List<TypeStatistics> selectRatingStatusTotal(TypeStatistics typeStatistics);
List<TypeStatistics> selectSangboTotal(TypeStatistics typeStatistics);
List<TypeStatistics> selectArrCntList(TypeStatistics typeStatistics);
String selectDocNo(Map<String, Object> params);
List<DashboardAffair> selectDashboardAffairList(DashboardAffair affair);

View File

@ -19,7 +19,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
@ -353,37 +352,4 @@ public class AffairService extends BaseService { // 견문보고
return affairRating;
}
public List<TypeStatistics> selectStatusTotal(TypeStatistics typeStatistics) {
return affairMapper.selectStatusTotal(typeStatistics);
}
public List<TypeStatistics> selectType1ListCnt(TypeStatistics typeStatistics) {
return affairMapper.selectType1ListCnt(typeStatistics);
}
public List<TypeStatistics> selectType2ListCnt(TypeStatistics typeStatistics) {
return affairMapper.selectType2ListCnt(typeStatistics);
}
public List<TypeStatistics> selectType3ListCnt(TypeStatistics typeStatistics) {
return affairMapper.selectType3ListCnt(typeStatistics);
}
public List<TypeStatistics> selectType4ListCnt(TypeStatistics typeStatistics) {
return affairMapper.selectType4ListCnt(typeStatistics);
}
public List<TypeStatistics> selectRatingStatusTotal(TypeStatistics typeStatistics) {
return affairMapper.selectRatingStatusTotal(typeStatistics);
}
public List<TypeStatistics> selectSangboTotal(TypeStatistics typeStatistics) {
return affairMapper.selectSangboTotal(typeStatistics);
}
public List<TypeStatistics> selectArrCntList(TypeStatistics typeStatistics) {
return affairMapper.selectArrCntList(typeStatistics);
}
public List<TypeStatistics> selectPersonalStatusTotal(TypeStatistics typeStatistics) {
return new ArrayList<>();
}
}

View File

@ -0,0 +1,129 @@
package com.dbnt.faisp.main.fpiMgt.statistics;
import com.dbnt.faisp.main.fpiMgt.statistics.model.PersonalAffairStatistics;
import com.dbnt.faisp.main.fpiMgt.statistics.model.TypeStatistics;
import com.dbnt.faisp.main.fpiMgt.statistics.service.AffairStatisticsService;
import com.dbnt.faisp.main.userInfo.model.PersonnelStatus;
import com.dbnt.faisp.main.userInfo.model.UserInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequiredArgsConstructor
@RequestMapping("/affairStatistics")
public class AffairStatisticsController {
private final AffairStatisticsService affairStatisticsService;
@GetMapping("/statistics")
public ModelAndView statistics(@AuthenticationPrincipal UserInfo loginUser, TypeStatistics typeStatistics){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/statistics/affairStatistics");
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
mav.addObject("searchParams", typeStatistics);
return mav;
}
@PostMapping("/fieldStatistics")
public ModelAndView fieldStatistics(TypeStatistics typeStatistics){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/statistics/fieldStatistics");
List<TypeStatistics> totalList = affairStatisticsService.selectStatusTotal(typeStatistics);
List<TypeStatistics> type1List = affairStatisticsService.selectType1ListCnt(typeStatistics);
List<TypeStatistics> type2List = affairStatisticsService.selectType2ListCnt(typeStatistics);
List<TypeStatistics> type3List = affairStatisticsService.selectType3ListCnt(typeStatistics);
List<TypeStatistics> type4List = affairStatisticsService.selectType4ListCnt(typeStatistics);
if(!totalList.isEmpty()) {
TypeStatistics total = new TypeStatistics();
total.setItemValue("누계");
total.setWrtOrgan("total");
total.setCnt(0);
for(TypeStatistics stat: totalList) {
total.setCnt(total.getCnt()+stat.getCnt());
}
totalList.add(total);
}
mav.addObject("totalList", totalList);
if(typeStatistics.getCategory1() != null) {
addTotalRow(typeStatistics.getCategory1(), type1List);
}
if(typeStatistics.getCategory2() != null) {
addTotalRow(typeStatistics.getCategory2(), type2List);
}
if(typeStatistics.getCategory3() != null) {
addTotalRow(typeStatistics.getCategory3(), type3List);
}
if(typeStatistics.getCategory4() != null) {
addTotalRow(typeStatistics.getCategory4(), type4List);
}
mav.addObject("type1List", type1List);
mav.addObject("type2List", type2List);
mav.addObject("type3List", type3List);
mav.addObject("type4List", type4List);
mav.addObject("searchParams", typeStatistics);
return mav;
}
@PostMapping("/ratingStatistics")
public ModelAndView ratingStatistics(TypeStatistics typeStatistics){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/statistics/ratingStatistics");
List<TypeStatistics> totalList = affairStatisticsService.selectRatingStatusTotal(typeStatistics);
List<TypeStatistics> sangboCntList = affairStatisticsService.selectSangboTotal(typeStatistics);
List<TypeStatistics> arrCntList = affairStatisticsService.selectArrCntList(typeStatistics);
if(!totalList.isEmpty()) {
TypeStatistics total = new TypeStatistics();
total.setItemValue("누계");
total.setWrtOrgan("total");
total.setCnt(0);
for(TypeStatistics stat: totalList) {
total.setCnt(total.getCnt()+stat.getCnt());
}
totalList.add(total);
}
if(typeStatistics.getSangbo() != null) {
addTotalRow(typeStatistics.getSangbo(), sangboCntList);
}
if(typeStatistics.getRating() != null) {
addTotalRow(typeStatistics.getRating(), arrCntList);
}
mav.addObject("totalList", totalList);
mav.addObject("sangboList", sangboCntList);
mav.addObject("arrCntList", arrCntList);
mav.addObject("searchParams", typeStatistics);
return mav;
}
@PostMapping("/personalStatistics")
public ModelAndView personalStatistics(PersonalAffairStatistics personnelStatistics){
ModelAndView mav = new ModelAndView("igActivities/fpiMgt/statistics/personalStatistics");
List<PersonalAffairStatistics> statisticsList = affairStatisticsService.selectPersonalStatistics(personnelStatistics);
mav.addObject("statisticsList", statisticsList);
mav.addObject("searchParams", personnelStatistics);
return mav;
}
private void addTotalRow(List<String> type, List<TypeStatistics> typeList){
Map<String, Integer> totalMap = new HashMap<>();
for(String t: type) {
totalMap.put(t, 0);
}
for(TypeStatistics t: typeList) {
totalMap.put(t.getAffairType(), totalMap.get(t.getAffairType())+t.getCnt());
}
for (String affairType : totalMap.keySet()) {
Integer cnt = totalMap.get(affairType);
TypeStatistics total = new TypeStatistics();
total.setWrtOrgan("total");
total.setAffairType(affairType);
total.setCnt(cnt);
typeList.add(total);
}
}
}

View File

@ -0,0 +1,30 @@
package com.dbnt.faisp.main.fpiMgt.statistics.mapper;
import com.dbnt.faisp.main.fpiMgt.statistics.model.PersonalAffairStatistics;
import com.dbnt.faisp.main.fpiMgt.statistics.model.TypeStatistics;
import com.dbnt.faisp.main.userInfo.model.PersonnelStatus;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface AffairStatisticsMapper {
List<TypeStatistics> selectStatusTotal(TypeStatistics typeStatistics);
List<TypeStatistics> selectType1ListCnt(TypeStatistics typeStatistics);
List<TypeStatistics> selectType2ListCnt(TypeStatistics typeStatistics);
List<TypeStatistics> selectType3ListCnt(TypeStatistics typeStatistics);
List<TypeStatistics> selectType4ListCnt(TypeStatistics typeStatistics);
List<TypeStatistics> selectRatingStatusTotal(TypeStatistics typeStatistics);
List<TypeStatistics> selectSangboTotal(TypeStatistics typeStatistics);
List<TypeStatistics> selectArrCntList(TypeStatistics typeStatistics);
List<PersonalAffairStatistics> selectPersonalStatistics(PersonalAffairStatistics personalStatistics);
}

View File

@ -0,0 +1,49 @@
package com.dbnt.faisp.main.fpiMgt.statistics.model;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.Transient;
@Getter
@Setter
@NoArgsConstructor
public class PersonalAffairStatistics extends TypeStatistics {
@Transient
private String userStatus;
@Transient
private String ogCd;
@Transient
private String ofcCd;
@Transient
private String titleCd;
@Transient
private String dicCode;
@Transient
private Integer r1Cnt;
@Transient
private Integer r2Cnt;
@Transient
private Integer r3Cnt;
@Transient
private Integer r4Cnt;
@Transient
private Integer r5Cnt;
@Transient
private Integer r6Cnt;
@Transient
private Integer r7Cnt;
@Transient
private Integer r8Cnt;
@Transient
private Integer totalCnt;
}

View File

@ -1,4 +1,4 @@
package com.dbnt.faisp.main.fpiMgt.affair.model;
package com.dbnt.faisp.main.fpiMgt.statistics.model;
import com.dbnt.faisp.config.BaseModel;
@ -26,6 +26,8 @@ public class TypeStatistics extends BaseModel {
@Transient
private String userNm;
@Transient
private List<String> organList;
@Transient
private List<String> rating;
@Transient
private List<String> category1;
@ -36,8 +38,6 @@ public class TypeStatistics extends BaseModel {
@Transient
private List<String> category4;
@Transient
private List<String> organList;
@Transient
private List<String> sangbo;
}

View File

@ -0,0 +1,52 @@
package com.dbnt.faisp.main.fpiMgt.statistics.service;
import com.dbnt.faisp.config.BaseService;
import com.dbnt.faisp.main.fpiMgt.statistics.mapper.AffairStatisticsMapper;
import com.dbnt.faisp.main.fpiMgt.statistics.model.PersonalAffairStatistics;
import com.dbnt.faisp.main.fpiMgt.statistics.model.TypeStatistics;
import com.dbnt.faisp.main.userInfo.model.PersonnelStatus;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
@RequiredArgsConstructor
public class AffairStatisticsService extends BaseService {
private final AffairStatisticsMapper affairStatisticsMapper;
public List<TypeStatistics> selectStatusTotal(TypeStatistics typeStatistics) {
return affairStatisticsMapper.selectStatusTotal(typeStatistics);
}
public List<TypeStatistics> selectType1ListCnt(TypeStatistics typeStatistics) {
return affairStatisticsMapper.selectType1ListCnt(typeStatistics);
}
public List<TypeStatistics> selectType2ListCnt(TypeStatistics typeStatistics) {
return affairStatisticsMapper.selectType2ListCnt(typeStatistics);
}
public List<TypeStatistics> selectType3ListCnt(TypeStatistics typeStatistics) {
return affairStatisticsMapper.selectType3ListCnt(typeStatistics);
}
public List<TypeStatistics> selectType4ListCnt(TypeStatistics typeStatistics) {
return affairStatisticsMapper.selectType4ListCnt(typeStatistics);
}
public List<TypeStatistics> selectRatingStatusTotal(TypeStatistics typeStatistics) {
return affairStatisticsMapper.selectRatingStatusTotal(typeStatistics);
}
public List<TypeStatistics> selectSangboTotal(TypeStatistics typeStatistics) {
return affairStatisticsMapper.selectSangboTotal(typeStatistics);
}
public List<TypeStatistics> selectArrCntList(TypeStatistics typeStatistics) {
return affairStatisticsMapper.selectArrCntList(typeStatistics);
}
public List<PersonalAffairStatistics> selectPersonalStatistics(PersonalAffairStatistics personalStatistics) {
return affairStatisticsMapper.selectPersonalStatistics(personalStatistics);
}
}

View File

@ -184,479 +184,6 @@
</if>
</sql>
<sql id="statisticsCategory1">
<choose>
<when test='category1 != null and category1 != ""'>
and item_cd in
<foreach collection="category1" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC01')
</otherwise>
</choose>
</sql>
<sql id="statisticsCategory2">
<choose>
<when test='category2 != null and category2 != ""'>
and item_cd in
<foreach collection="category2" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC02')
</otherwise>
</choose>
</sql>
<sql id="statisticsCategory3">
<choose>
<when test='category3 != null and category3 != ""'>
and item_cd in
<foreach collection="category3" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC03')
</otherwise>
</choose>
</sql>
<sql id="statisticsCategory4">
<choose>
<when test='category4 != null and category4 != ""'>
and item_cd in
<foreach collection="category4" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC04')
</otherwise>
</choose>
</sql>
<select id="selectStatusTotal" resultType="TypeStatistics" parameterType="TypeStatistics">
select item_cd as wrt_organ,
item_value,
coalesce(cnt,0) as cnt
from(
select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T'
<choose>
<when test='organList != null and organList != ""'>
and item_cd in
<foreach collection="organList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'OG' and use_chk = 'T')
</otherwise>
</choose>
order by item_cd asc) a left outer join
(select wrt_organ,
count(*) as cnt
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and (ar.organ_up != 'T' or ar.organ_up is null)
<if test='userNm != null and userNm != ""'>
and wrt_user_nm like '%'||#{userNm}||'%'
</if>
<if test='startDate != null and startDate != ""'>
and wrt_dt >= #{startDate}::date
</if>
<if test='endDate != null and endDate != ""'>
and wrt_dt &lt;= #{endDate}::date+1
</if>
<if test='rating != null and rating != "" or sangbo != null and sangbo != ""'>
and ab.affair_key in (
select affair_key
from affair_rating ar2
inner join organ_config oc2
on ar2.rating_organ = oc2.organ_cd
<where>
<if test='rating != null and rating != ""'>
and ar2.affair_rate in
<foreach collection="rating" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='sangbo != null and sangbo != ""'>
and ar2.organ_up = 'T'
and oc2.organ_type in
<foreach collection="sangbo" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
)
</if>
<if test='category1 != null and category1 != ""'>
and affair_type1 in
<foreach collection="category1" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category2 != null and category2 != ""'>
and affair_type2 in
<foreach collection="category2" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category3 != null and category3 != ""'>
and affair_type3 in
<foreach collection="category3" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category4 != null and category4 != ""'>
and affair_type4 in
<foreach collection="category4" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
group by wrt_organ)b on
a.item_cd = b.wrt_organ
order by wrt_organ asc
</select>
<select id="selectType1ListCnt" resultType="TypeStatistics" parameterType="TypeStatistics">
select b.item_cd as wrt_organ ,
b.item_value,
a.item_cd as affair_type,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'DC01'
<include refid="statisticsCategory1"></include>
)a left join
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T'
<if test='organList != null and organList != ""'>
and item_cd in
<foreach collection="organList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
order by item_cd asc) b on 1=1
left outer join
(select wrt_organ,
affair_type1 as affair_type,
count(*) as cnt
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and (ar.organ_up != 'T' or ar.organ_up is null)
<include refid="searchStatistics"></include>
group by wrt_organ,affair_type1) c
on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ
order by wrt_organ,affair_type asc
</select>
<select id="selectType2ListCnt" resultType="TypeStatistics" parameterType="TypeStatistics">
select b.item_cd as wrt_organ ,
b.item_value,
a.item_cd as affair_type,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'DC02'
<include refid="statisticsCategory2"></include>
)a left join
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T'
<if test='organList != null and organList != ""'>
and item_cd in
<foreach collection="organList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
order by item_cd asc) b on 1=1
left outer join
(select wrt_organ,
affair_type2 as affair_type,
count(*) as cnt
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and (ar.organ_up != 'T' or ar.organ_up is null)
<include refid="searchStatistics"></include>
group by wrt_organ,affair_type2) c
on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ
order by wrt_organ,affair_type asc
</select>
<select id="selectType3ListCnt" resultType="TypeStatistics" parameterType="TypeStatistics">
select b.item_cd as wrt_organ ,
b.item_value,
a.item_cd as affair_type,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'DC03'
<include refid="statisticsCategory3"></include>
)a left join
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T'
<if test='organList != null and organList != ""'>
and item_cd in
<foreach collection="organList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
order by item_cd asc) b on 1=1
left outer join
(select wrt_organ,
affair_type3 as affair_type,
count(*) as cnt
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and (ar.organ_up != 'T' or ar.organ_up is null)
<include refid="searchStatistics"></include>
group by wrt_organ,affair_type3) c
on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ
order by wrt_organ,affair_type asc
</select>
<select id="selectType4ListCnt" resultType="TypeStatistics" parameterType="TypeStatistics">
select b.item_cd as wrt_organ ,
b.item_value,
a.item_cd as affair_type,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'DC04'
<include refid="statisticsCategory4"></include>
)a left join
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T'
<if test='organList != null and organList != ""'>
and item_cd in
<foreach collection="organList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
order by item_cd asc) b on 1=1
left outer join
(select wrt_organ,
affair_type4 as affair_type,
count(*) as cnt
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and (ar.organ_up != 'T' or ar.organ_up is null)
<include refid="searchStatistics"></include>
group by wrt_organ,affair_type4) c
on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ
order by wrt_organ,affair_type asc
</select>
<sql id="raitingSearch">
<if test='userNm != null and userNm != ""'>
and wrt_user_nm like '%'||#{userNm}||'%'
</if>
<if test='startDate != null and startDate != ""'>
and wrt_dt >= #{startDate}::date
</if>
<if test='endDate != null and endDate != ""'>
and wrt_dt &lt;= #{endDate}::date+1
</if>
<if test='rating != null and rating != "" or sangbo != null and sangbo != ""'>
and ab.affair_key in (
select affair_key
from affair_rating ar2
inner join organ_config oc2
on ar2.rating_organ = oc2.organ_cd
<where>
<if test='rating != null and rating != ""'>
and ar2.affair_rate in
<foreach collection="rating" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='sangbo != null and sangbo != ""'>
and ar2.organ_up = 'T'
and oc2.organ_type in
<foreach collection="sangbo" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
)
</if>
<if test='category1 != null and category1 != ""'>
and affair_type1 in
<foreach collection="category1" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category2 != null and category2 != ""'>
and affair_type2 in
<foreach collection="category2" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category3 != null and category3 != ""'>
and affair_type3 in
<foreach collection="category3" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category4 != null and category4 != ""'>
and affair_type4 in
<foreach collection="category4" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</sql>
<select id="selectRatingStatusTotal" resultType="TypeStatistics" parameterType="TypeStatistics">
select item_cd as wrt_organ,
item_value,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T'
<choose>
<when test='organList != null and organList != ""'>
and item_cd in
<foreach collection="organList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'OG' and use_chk = 'T')
</otherwise>
</choose>
) a
left outer join
(select ab.wrt_organ,
count(*) as cnt
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and (ar.organ_up != 'T' or ar.organ_up is null)
<include refid="raitingSearch"></include>
group by ab.wrt_organ) c
on a.item_cd = c.wrt_organ
order by item_cd asc
</select>
<select id="selectSangboTotal" resultType="TypeStatistics" parameterType="TypeStatistics">
select item_cd as wrt_organ,
item_value,
b.organ_type as affairType,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T') a left join
(select organ_type
from organ_config
<where>
<choose>
<when test='sangbo != null and sangbo != ""'>
organ_type in
<foreach collection="sangbo" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
organ_type not in (select organ_type from organ_config)
</otherwise>
</choose>
</where>
group by organ_type) b on 1=1
left outer join
(select ab.wrt_organ,
oc.organ_type,
count(*) as cnt
from affair_board ab,
affair_rating ar,
organ_config oc
where ab.affair_key = ar.affair_key
and ar.rating_organ = oc.organ_cd
and (ar.organ_up != 'T' or ar.organ_up is null)
<include refid="raitingSearch"></include>
group by ab.wrt_organ,oc.organ_type) c
on a.item_cd = c.wrt_organ and b.organ_type = c.organ_type
order by item_cd, affairType asc
</select>
<select id="selectArrCntList" resultType="TypeStatistics" parameterType="TypeStatistics">
select a.item_cd as wrt_organ,
b.item_cd as affairType,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T') a left join
(select item_cd
from code_mgt
where category_cd='AAR'
<choose>
<when test='rating != null and rating != ""'>
and item_cd in
<foreach collection="rating" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd='AAR')
</otherwise>
</choose>
) b on 1=1
left outer join
(select ab.wrt_organ,
ar.affair_rate,
count(*) as cnt
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and (ar.organ_up != 'T' or ar.organ_up is null)
<include refid="raitingSearch"></include>
group by ab.wrt_organ,ar.affair_rate) c
on c.wrt_organ = a.item_cd and c.affair_rate = b.item_cd
order by wrt_organ,affairType asc
</select>
<select id="selectDashboardAffairList" parameterType="DashboardAffair" resultType="DashboardAffair">
select 'plan1' as board,
a.plan_key as key,

View File

@ -0,0 +1,628 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dbnt.faisp.main.fpiMgt.statistics.mapper.AffairStatisticsMapper">
<sql id="searchStatistics">
<if test='userNm != null and userNm != ""'>
and wrt_user_nm like '%'||#{userNm}||'%'
</if>
<if test='startDate != null and startDate != ""'>
and wrt_dt >= #{startDate}::date
</if>
<if test='endDate != null and endDate != ""'>
and wrt_dt &lt;= #{endDate}::date+1
</if>
<if test='rating != null and rating != "" or sangbo != null and sangbo != ""'>
and ab.affair_key in (
select affair_key
from affair_rating ar2
inner join organ_config oc2
on ar2.rating_organ = oc2.organ_cd
<where>
<if test='rating != null and rating != ""'>
and ar2.affair_rate in
<foreach collection="rating" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='sangbo != null and sangbo != ""'>
and ar2.organ_up = 'T'
and oc2.organ_type in
<foreach collection="sangbo" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
)
</if>
</sql>
<sql id="statisticsCategory1">
<choose>
<when test='category1 != null and category1 != ""'>
and item_cd in
<foreach collection="category1" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC01')
</otherwise>
</choose>
</sql>
<sql id="statisticsCategory2">
<choose>
<when test='category2 != null and category2 != ""'>
and item_cd in
<foreach collection="category2" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC02')
</otherwise>
</choose>
</sql>
<sql id="statisticsCategory3">
<choose>
<when test='category3 != null and category3 != ""'>
and item_cd in
<foreach collection="category3" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC03')
</otherwise>
</choose>
</sql>
<sql id="statisticsCategory4">
<choose>
<when test='category4 != null and category4 != ""'>
and item_cd in
<foreach collection="category4" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'DC04')
</otherwise>
</choose>
</sql>
<select id="selectStatusTotal" resultType="TypeStatistics" parameterType="TypeStatistics">
select item_cd as wrt_organ,
item_value,
coalesce(cnt,0) as cnt
from(
select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T'
<choose>
<when test='organList != null and organList != ""'>
and item_cd in
<foreach collection="organList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'OG' and use_chk = 'T')
</otherwise>
</choose>
order by item_cd asc) a left outer join
(select wrt_organ,
count(*) as cnt
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and (ar.organ_up != 'T' or ar.organ_up is null)
<if test='userNm != null and userNm != ""'>
and wrt_user_nm like '%'||#{userNm}||'%'
</if>
<if test='startDate != null and startDate != ""'>
and wrt_dt >= #{startDate}::date
</if>
<if test='endDate != null and endDate != ""'>
and wrt_dt &lt;= #{endDate}::date+1
</if>
<if test='rating != null and rating != "" or sangbo != null and sangbo != ""'>
and ab.affair_key in (
select affair_key
from affair_rating ar2
inner join organ_config oc2
on ar2.rating_organ = oc2.organ_cd
<where>
<if test='rating != null and rating != ""'>
and ar2.affair_rate in
<foreach collection="rating" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='sangbo != null and sangbo != ""'>
and ar2.organ_up = 'T'
and oc2.organ_type in
<foreach collection="sangbo" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
)
</if>
<if test='category1 != null and category1 != ""'>
and affair_type1 in
<foreach collection="category1" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category2 != null and category2 != ""'>
and affair_type2 in
<foreach collection="category2" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category3 != null and category3 != ""'>
and affair_type3 in
<foreach collection="category3" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category4 != null and category4 != ""'>
and affair_type4 in
<foreach collection="category4" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
group by wrt_organ)b on
a.item_cd = b.wrt_organ
order by wrt_organ asc
</select>
<select id="selectType1ListCnt" resultType="TypeStatistics" parameterType="TypeStatistics">
select b.item_cd as wrt_organ ,
b.item_value,
a.item_cd as affair_type,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'DC01'
<include refid="statisticsCategory1"></include>
)a left join
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T'
<if test='organList != null and organList != ""'>
and item_cd in
<foreach collection="organList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
order by item_cd asc) b on 1=1
left outer join
(select wrt_organ,
affair_type1 as affair_type,
count(*) as cnt
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and (ar.organ_up != 'T' or ar.organ_up is null)
<include refid="searchStatistics"></include>
group by wrt_organ,affair_type1) c
on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ
order by wrt_organ,affair_type asc
</select>
<select id="selectType2ListCnt" resultType="TypeStatistics" parameterType="TypeStatistics">
select b.item_cd as wrt_organ ,
b.item_value,
a.item_cd as affair_type,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'DC02'
<include refid="statisticsCategory2"></include>
)a left join
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T'
<if test='organList != null and organList != ""'>
and item_cd in
<foreach collection="organList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
order by item_cd asc) b on 1=1
left outer join
(select wrt_organ,
affair_type2 as affair_type,
count(*) as cnt
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and (ar.organ_up != 'T' or ar.organ_up is null)
<include refid="searchStatistics"></include>
group by wrt_organ,affair_type2) c
on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ
order by wrt_organ,affair_type asc
</select>
<select id="selectType3ListCnt" resultType="TypeStatistics" parameterType="TypeStatistics">
select b.item_cd as wrt_organ ,
b.item_value,
a.item_cd as affair_type,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'DC03'
<include refid="statisticsCategory3"></include>
)a left join
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T'
<if test='organList != null and organList != ""'>
and item_cd in
<foreach collection="organList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
order by item_cd asc) b on 1=1
left outer join
(select wrt_organ,
affair_type3 as affair_type,
count(*) as cnt
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and (ar.organ_up != 'T' or ar.organ_up is null)
<include refid="searchStatistics"></include>
group by wrt_organ,affair_type3) c
on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ
order by wrt_organ,affair_type asc
</select>
<select id="selectType4ListCnt" resultType="TypeStatistics" parameterType="TypeStatistics">
select b.item_cd as wrt_organ ,
b.item_value,
a.item_cd as affair_type,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'DC04'
<include refid="statisticsCategory4"></include>
)a left join
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T'
<if test='organList != null and organList != ""'>
and item_cd in
<foreach collection="organList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
order by item_cd asc) b on 1=1
left outer join
(select wrt_organ,
affair_type4 as affair_type,
count(*) as cnt
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and (ar.organ_up != 'T' or ar.organ_up is null)
<include refid="searchStatistics"></include>
group by wrt_organ,affair_type4) c
on a.item_cd = c.affair_type and b.item_cd = c.wrt_organ
order by wrt_organ,affair_type asc
</select>
<sql id="raitingSearch">
<if test='userNm != null and userNm != ""'>
and wrt_user_nm like '%'||#{userNm}||'%'
</if>
<if test='startDate != null and startDate != ""'>
and wrt_dt >= #{startDate}::date
</if>
<if test='endDate != null and endDate != ""'>
and wrt_dt &lt;= #{endDate}::date+1
</if>
<if test='rating != null and rating != "" or sangbo != null and sangbo != ""'>
and ab.affair_key in (
select affair_key
from affair_rating ar2
inner join organ_config oc2
on ar2.rating_organ = oc2.organ_cd
<where>
<if test='rating != null and rating != ""'>
and ar2.affair_rate in
<foreach collection="rating" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='sangbo != null and sangbo != ""'>
and ar2.organ_up = 'T'
and oc2.organ_type in
<foreach collection="sangbo" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
)
</if>
<if test='category1 != null and category1 != ""'>
and affair_type1 in
<foreach collection="category1" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category2 != null and category2 != ""'>
and affair_type2 in
<foreach collection="category2" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category3 != null and category3 != ""'>
and affair_type3 in
<foreach collection="category3" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category4 != null and category4 != ""'>
and affair_type4 in
<foreach collection="category4" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</sql>
<select id="selectRatingStatusTotal" resultType="TypeStatistics" parameterType="TypeStatistics">
select item_cd as wrt_organ,
item_value,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T'
<choose>
<when test='organList != null and organList != ""'>
and item_cd in
<foreach collection="organList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd = 'OG' and use_chk = 'T')
</otherwise>
</choose>
) a
left outer join
(select ab.wrt_organ,
count(*) as cnt
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and (ar.organ_up != 'T' or ar.organ_up is null)
<include refid="raitingSearch"></include>
group by ab.wrt_organ) c
on a.item_cd = c.wrt_organ
order by item_cd asc
</select>
<select id="selectSangboTotal" resultType="TypeStatistics" parameterType="TypeStatistics">
select item_cd as wrt_organ,
item_value,
b.organ_type as affairType,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T') a left join
(select organ_type
from organ_config
<where>
<choose>
<when test='sangbo != null and sangbo != ""'>
organ_type in
<foreach collection="sangbo" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
organ_type not in (select organ_type from organ_config)
</otherwise>
</choose>
</where>
group by organ_type) b on 1=1
left outer join
(select ab.wrt_organ,
oc.organ_type,
count(*) as cnt
from affair_board ab,
affair_rating ar,
organ_config oc
where ab.affair_key = ar.affair_key
and ar.rating_organ = oc.organ_cd
and (ar.organ_up != 'T' or ar.organ_up is null)
<include refid="raitingSearch"></include>
group by ab.wrt_organ,oc.organ_type) c
on a.item_cd = c.wrt_organ and b.organ_type = c.organ_type
order by item_cd, affairType asc
</select>
<select id="selectArrCntList" resultType="TypeStatistics" parameterType="TypeStatistics">
select a.item_cd as wrt_organ,
b.item_cd as affairType,
coalesce(cnt,0) as cnt
from
(select item_cd,
item_value
from code_mgt
where category_cd = 'OG'
and use_chk = 'T') a left join
(select item_cd
from code_mgt
where category_cd='AAR'
<choose>
<when test='rating != null and rating != ""'>
and item_cd in
<foreach collection="rating" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</when>
<otherwise>
and item_cd not in (select item_cd from code_mgt where category_cd='AAR')
</otherwise>
</choose>
) b on 1=1
left outer join
(select ab.wrt_organ,
ar.affair_rate,
count(*) as cnt
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and (ar.organ_up != 'T' or ar.organ_up is null)
<include refid="raitingSearch"></include>
group by ab.wrt_organ,ar.affair_rate) c
on c.wrt_organ = a.item_cd and c.affair_rate = b.item_cd
order by wrt_organ,affairType asc
</select>
<sql id="selectPersonalStatisticsWhere">
<where>
<choose>
<when test='userStatus != null and userStatus != ""'>
and user_status = #{userStatus}
</when>
<otherwise>
and user_status in ('USC003', 'USC007')
</otherwise>
</choose>
<if test='userNm != null and userNm != ""'>
and user_nm like '%'||#{userNm}||'%'
</if>
<if test='organList != null'>
and og_cd in
<foreach collection="organList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
</sql>
<sql id="selectPersonalStatisticsSubWhere">
<where>
<if test='startDate != null and startDate != ""'>
and aa.wrt_dt >= #{startDate}::date
</if>
<if test='endDate != null and endDate != ""'>
and aa.wrt_dt &lt;= #{endDate}::date+1
</if>
<if test='rating != null'>
and ab.affair_rate in
<foreach collection="rating" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category1 != null'>
and aa.affair_type1 in
<foreach collection="category1" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category2 != null'>
and aa.affair_type2 in
<foreach collection="category2" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category3 != null'>
and aa.affair_type3 in
<foreach collection="category3" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='category4 != null'>
and aa.affair_type4 in
<foreach collection="category4" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test='sangbo != null'>
and aa.affair_key in (
select aaa.affair_key
from affair_rating aaa
inner join organ_config aab
on aaa.rating_organ = aab.organ_cd
where aaa.organ_up = 'T'
and aab.organ_type in
<foreach collection="sangbo" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
)
</if>
</where>
</sql>
<select id="selectPersonalStatistics" resultType="PersonalAffairStatistics" parameterType="PersonalAffairStatistics">
select user_status,
og_cd,
ofc_cd,
title_cd,
dic_code,
user_nm,
b.r1Cnt,
b.r2Cnt,
b.r3Cnt,
b.r4Cnt,
b.r5Cnt,
b.r6Cnt,
b.r7Cnt,
b.r8Cnt,
b.totalCnt
from user_info a
inner join
(
select aa.wrt_user_seq ,
sum(case when ab.affair_rate = 'AAR001' then 1 else 0 end) as r1Cnt,
sum(case when ab.affair_rate = 'AAR002' then 1 else 0 end) as r2Cnt,
sum(case when ab.affair_rate = 'AAR003' then 1 else 0 end) as r3Cnt,
sum(case when ab.affair_rate = 'AAR004' then 1 else 0 end) as r4Cnt,
sum(case when ab.affair_rate = 'AAR005' then 1 else 0 end) as r5Cnt,
sum(case when ab.affair_rate = 'AAR006' then 1 else 0 end) as r6Cnt,
sum(case when ab.affair_rate = 'AAR007' then 1 else 0 end) as r7Cnt,
sum(case when ab.affair_rate = 'AAR008' then 1 else 0 end) as r8Cnt,
count(*) as totalCnt
from affair_board aa
inner join affair_rating ab
on aa.affair_key = ab.affair_key and ab.affair_rate is not null and ab.organ_up = 'F'
<include refid="selectPersonalStatisticsSubWhere"></include>
group by aa.wrt_user_seq
) b on a.user_seq = b.wrt_user_seq
<include refid="selectPersonalStatisticsWhere"></include>
order by og_cd, ofc_cd, title_cd
</select>
</mapper>

View File

@ -14,6 +14,10 @@ $(document).on('click', '#ratingDownExcel', function (){
exportExcel('견문통계_평가별', 'tableData');
})
$(document).on('click', '#personalDownExcel', function (){
exportExcel('견문통계_개인실적', 'tableData');
})
$(document).on('click', '#fieldSearch', function (){
goFieldStatistics();
})
@ -38,18 +42,18 @@ $(document).on('click', '#ratingTab', function (){
})
$(document).on('click', '#personalSearch', function (){
goPersonalStatistics();
getPersonalStatistics();
})
$(document).on('click', '#personalTab', function (){
goPersonalStatistics();
getPersonalStatistics();
})
function goFieldStatistics(){
contentFade("in")
const formData = new FormData($("#searchFm")[0]);
$.ajax({
url: '/affair/fieldStatistics',
url: '/affairStatistics/fieldStatistics',
data: formData,
type: 'POST',
dataType:"html",
@ -71,7 +75,7 @@ function goRatingStatistics(){
contentFade("in")
const formData = new FormData($("#searchFm")[0]);
$.ajax({
url: '/affair/ratingStatistics',
url: '/affairStatistics/ratingStatistics',
data: formData,
type: 'POST',
dataType:"html",
@ -89,13 +93,13 @@ function goRatingStatistics(){
});
}
function goPersonalStatistics(){
function getPersonalStatistics(){
contentFade("in")
const formData = new FormData($("#searchFm")[0]);
$.ajax({
url: '/affair/personalStatistics',
url: '/affairStatistics/personalStatistics',
data: formData,
type: 'GET',
type: 'POST',
dataType:"html",
contentType: false,
processData: false,
@ -111,10 +115,6 @@ function goPersonalStatistics(){
});
}
$(document).on('click', '#showMenu', function (){
$(".statisticsMenu").show();
})
$(document).ready(function() {
$("#organAll").click(function() {
if($("#organAll").is(":checked")){

View File

@ -11,8 +11,6 @@
<div layout:fragment="content">
<main>
<input type="hidden" id="menuKey" value="39">
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<div class="row justify-content-between">
<div class="col-auto">
<div class="d-inline align-middle"><i class="bi bi-square-fill"></i></div>
@ -23,7 +21,7 @@
<div class="row mx-0">
<div class="col-12 card bg-light text-center">
<div class="card-body">
<div class="card statisticsMenu">
<div class="card">
<div class="card-body">
<form id="searchFm">
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
@ -139,12 +137,12 @@
</form>
</div>
</div>
</div>
<div class="row justify-content-start pt-1">
<div class="col-12" id="statisticsBody" style="display:none;"></div>
</div>
</div>
</div>
</div>
</main>
</div>
</html>

View File

@ -1,3 +1,5 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<ul class="nav nav-tabs" id="userTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="fieldTab" data-bs-toggle="tab" type="button" role="tab">분야별</button>
@ -12,7 +14,6 @@
<div class="tab-content bg-white border border-top-0 p-2">
<div class="row justify-content-end">
<div class="col-auto">
<button class="btn btn-primary" id="showMenu">검색조건열기</button>
<button class="btn btn-success" id="fieldDownExcel">엑셀다운</button>
</div>
</div>
@ -115,3 +116,4 @@
</div>
</div>
</div>
</html>

View File

@ -1,3 +1,5 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<ul class="nav nav-tabs" id="userTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link" id="fieldTab" data-bs-toggle="tab" type="button" role="tab">분야별</button>
@ -12,11 +14,102 @@
<div class="tab-content bg-white border border-top-0 p-2">
<div class="row justify-content-end">
<div class="col-auto">
<button class="btn btn-primary" id="showMenu">검색조건열기</button>
<button class="btn btn-success" id="fieldDownExcel">엑셀다운</button>
<button class="btn btn-success" id="personalDownExcel">엑셀다운</button>
</div>
</div>
<div class="row pt-2" id="statisticsDiv">
<div class="row pt-2">
<div class="col-12">
<table class="table table-sm table-hover table-bordered" id="tableData">
<colgroup>
<col style="width: 5%">
<col style="width: 7%">
<col style="width: 7%">
<col style="width: 7%">
<col style="width: 5%">
<col style="width: 12%">
<col style="width: 12%">
<th:block th:each="code:${session.commonCode.get('AAR')}">
<th:block th:if="${#lists.contains(searchParams.rating, code.itemCd)}">
<col style="width: 5%">
</th:block>
</th:block>
<col style="width: 5%">
</colgroup>
<thead>
<tr class="table-secondary">
<th>순번</th>
<th>구분</th>
<th>소속</th>
<th>부서</th>
<th>계급</th>
<th>디지털 식별코드</th>
<th>성명</th>
<th:block th:each="code:${session.commonCode.get('AAR')}">
<th:block th:if="${#lists.contains(searchParams.rating, code.itemCd)}">
<th th:text="${code.itemValue}"></th>
</th:block>
</th:block>
<th>합계</th>
</tr>
</thead>
<tbody class="table-group-divider">
<tr th:each="statistics,idx:${statisticsList}">
<td th:text="${idx.count}"></td>
<td>
<th:block th:each="code:${session.commonCode.get('USC')}">
<th:block th:if="${code.itemCd eq statistics.userStatus}" th:text="${code.itemValue}"></th:block>
</th:block>
</td>
<td>
<th:block th:each="code:${session.commonCode.get('OG')}">
<th:block th:if="${code.itemCd eq statistics.ogCd}" th:text="${code.itemValue}"></th:block>
</th:block>
</td>
<td>
<th:block th:each="code:${session.commonCode.get('OFC')}">
<th:block th:if="${code.itemCd eq statistics.ofcCd}" th:text="${code.itemValue}"></th:block>
</th:block>
</td>
<td>
<th:block th:each="code:${session.commonCode.get('JT')}">
<th:block th:if="${code.itemCd eq statistics.titleCd}" th:text="${code.itemValue}"></th:block>
</th:block>
</td>
<td th:text="${statistics.dicCode}"></td>
<td th:text="${statistics.userNm}"></td>
<th:block th:each="code:${session.commonCode.get('AAR')}">
<th:block th:if="${#lists.contains(searchParams.rating, code.itemCd)}">
<th:block th:if="${code.itemCd eq 'AAR001'}">
<td th:text="${statistics.r1Cnt}"></td>
</th:block>
<th:block th:if="${code.itemCd eq 'AAR002'}">
<td th:text="${statistics.r2Cnt}"></td>
</th:block>
<th:block th:if="${code.itemCd eq 'AAR003'}">
<td th:text="${statistics.r3Cnt}"></td>
</th:block>
<th:block th:if="${code.itemCd eq 'AAR004'}">
<td th:text="${statistics.r4Cnt}"></td>
</th:block>
<th:block th:if="${code.itemCd eq 'AAR005'}">
<td th:text="${statistics.r5Cnt}"></td>
</th:block>
<th:block th:if="${code.itemCd eq 'AAR006'}">
<td th:text="${statistics.r6Cnt}"></td>
</th:block>
<th:block th:if="${code.itemCd eq 'AAR007'}">
<td th:text="${statistics.r7Cnt}"></td>
</th:block>
<th:block th:if="${code.itemCd eq 'AAR008'}">
<td th:text="${statistics.r8Cnt}"></td>
</th:block>
</th:block>
</th:block>
<td th:text="${statistics.totalCnt}"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</html>

View File

@ -1,3 +1,5 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<ul class="nav nav-tabs" id="userTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link" id="fieldTab" data-bs-toggle="tab" type="button" role="tab">분야별</button>
@ -12,7 +14,6 @@
<div class="tab-content bg-white border border-top-0 p-2">
<div class="row justify-content-end">
<div class="col-auto">
<button class="btn btn-primary" id="showMenu">검색조건열기</button>
<button class="btn btn-success" id="fieldDownExcel">엑셀다운</button>
</div>
</div>
@ -75,3 +76,4 @@
</div>
</div>
</div>
</html>

View File

@ -12,7 +12,7 @@
<main>
<div class="mb-2">
<div class="d-inline align-middle"><i class="bi bi-square-fill"></i></div>
<h5 class="d-inline align-middle mb-1"> QnA</h5>
<h5 class="d-inline align-middle mb-1"> Q&A</h5>
</div>
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>