治理设备管理指标分组功能
This commit is contained in:
@@ -24,4 +24,6 @@ public interface CsDataArrayMapper extends BaseMapper<CsDataArray> {
|
||||
|
||||
List<CsDataArray> getDictData(@Param("id") String id);
|
||||
|
||||
List<CsDataArray> getGroupData(@Param("id") String id);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsGroArr;
|
||||
import com.njcn.csdevice.pojo.vo.CsGroupVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 组和指标关系表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-06-19
|
||||
*/
|
||||
public interface CsGroArrMapper extends BaseMapper<CsGroArr> {
|
||||
|
||||
List<CsGroupVO> getGroupArrayList(@Param("list") List<String> list);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsGroup;
|
||||
import com.njcn.csdevice.pojo.vo.CsGroupVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据分组表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-06-16
|
||||
*/
|
||||
public interface CsGroupMapper extends BaseMapper<CsGroup> {
|
||||
|
||||
List<CsGroupVO> getGroupData(@Param("dataSet") String dataSet);
|
||||
|
||||
List<CsGroupVO> getGroupData2(@Param("dataSet") String dataSet);
|
||||
|
||||
List<CsGroupVO> getArrayData(@Param("list") List<String> list);
|
||||
|
||||
void insertList(@Param("list") List<CsGroup> list);
|
||||
}
|
||||
@@ -47,4 +47,22 @@
|
||||
where
|
||||
pid = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getGroupData" resultType="CsDataArray">
|
||||
select
|
||||
id ,
|
||||
name,
|
||||
another_name,
|
||||
phase
|
||||
from
|
||||
cs_data_array t0
|
||||
where
|
||||
pid = #{id} and stat_method = 'avg'
|
||||
group by
|
||||
id,
|
||||
name,
|
||||
another_name,
|
||||
phase
|
||||
order by min(sort)
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?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.njcn.csdevice.mapper.CsGroArrMapper">
|
||||
|
||||
<select id="getGroupArrayList" resultType="CsGroupVO">
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,74 @@
|
||||
<?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.njcn.csdevice.mapper.CsGroupMapper">
|
||||
|
||||
<select id="getGroupData" resultType="CsGroupVO">
|
||||
select
|
||||
id,
|
||||
'0' pid,
|
||||
group_name name
|
||||
from
|
||||
cs_group
|
||||
where
|
||||
data_set_id = #{dataSet}
|
||||
order by sort
|
||||
</select>
|
||||
|
||||
<select id="getGroupData2" resultType="CsGroupVO">
|
||||
select
|
||||
id,
|
||||
'0' pid,
|
||||
group_name name
|
||||
from
|
||||
cs_group
|
||||
where
|
||||
data_set_id = #{dataSet} and is_show = 1
|
||||
order by sort
|
||||
</select>
|
||||
|
||||
<select id="getArrayData" resultType="CsGroupVO">
|
||||
select
|
||||
t1.id,
|
||||
t0.group_id pid,
|
||||
case when t1.phase in ('A', 'B', 'C') then concat(t1.phase, "相", t1.another_name)
|
||||
when t1.phase in ('M', 'T') then t1.another_name
|
||||
else concat(t1.phase, t1.another_name)
|
||||
end name
|
||||
from
|
||||
cs_gro_arr t0
|
||||
left join
|
||||
cs_data_array t1 on t0.array_id = t1.id
|
||||
left join
|
||||
cs_group t2 on t0.group_id = t2.id
|
||||
where
|
||||
t0.group_id in
|
||||
<foreach collection='list' item='item' index="index" open='(' separator=',' close=')'>
|
||||
#{item}
|
||||
</foreach>
|
||||
and
|
||||
t2.is_show = 1
|
||||
order by t1.sort
|
||||
</select>
|
||||
|
||||
<insert id="insertList">
|
||||
insert into cs_group
|
||||
(
|
||||
id,
|
||||
data_set_id,
|
||||
group_name,
|
||||
sort,
|
||||
is_show
|
||||
)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
(
|
||||
#{item.id},
|
||||
#{item.dataSetId},
|
||||
#{item.groupName},
|
||||
#{item.sort},
|
||||
#{item.isShow}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user