374 lines
15 KiB
XML
374 lines
15 KiB
XML
<?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.rzyc.mapper.BasekpiMapper">
|
|
<resultMap id="BaseResultMap" type="com.rzyc.bean.Basekpi">
|
|
<id column="BaseKPIId" jdbcType="VARCHAR" property="basekpiid" />
|
|
<result column="KPICode" jdbcType="VARCHAR" property="kpicode" />
|
|
<result column="KPIName" jdbcType="VARCHAR" property="kpiname" />
|
|
<result column="SuperKPIId" jdbcType="VARCHAR" property="superkpiid" />
|
|
<result column="SuperKPICode" jdbcType="VARCHAR" property="superkpicode" />
|
|
<result column="SysLevel" jdbcType="INTEGER" property="syslevel" />
|
|
<result column="SortId" jdbcType="INTEGER" property="sortid" />
|
|
<result column="CreatedOn" jdbcType="TIMESTAMP" property="createdon" />
|
|
<result column="CreatedBy" jdbcType="VARCHAR" property="createdby" />
|
|
<result column="ModifiedOn" jdbcType="TIMESTAMP" property="modifiedon" />
|
|
<result column="ModifiedBy" jdbcType="VARCHAR" property="modifiedby" />
|
|
</resultMap>
|
|
<sql id="Example_Where_Clause">
|
|
<where>
|
|
<foreach collection="oredCriteria" item="criteria" separator="or">
|
|
<if test="criteria.valid">
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
<foreach collection="criteria.criteria" item="criterion">
|
|
<choose>
|
|
<when test="criterion.noValue">
|
|
and ${criterion.condition}
|
|
</when>
|
|
<when test="criterion.singleValue">
|
|
and ${criterion.condition} #{criterion.value}
|
|
</when>
|
|
<when test="criterion.betweenValue">
|
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
</when>
|
|
<when test="criterion.listValue">
|
|
and ${criterion.condition}
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
#{listItem}
|
|
</foreach>
|
|
</when>
|
|
</choose>
|
|
</foreach>
|
|
</trim>
|
|
</if>
|
|
</foreach>
|
|
</where>
|
|
</sql>
|
|
<sql id="Update_By_Example_Where_Clause">
|
|
<where>
|
|
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
|
<if test="criteria.valid">
|
|
<trim prefix="(" prefixOverrides="and" suffix=")">
|
|
<foreach collection="criteria.criteria" item="criterion">
|
|
<choose>
|
|
<when test="criterion.noValue">
|
|
and ${criterion.condition}
|
|
</when>
|
|
<when test="criterion.singleValue">
|
|
and ${criterion.condition} #{criterion.value}
|
|
</when>
|
|
<when test="criterion.betweenValue">
|
|
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
|
</when>
|
|
<when test="criterion.listValue">
|
|
and ${criterion.condition}
|
|
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
|
#{listItem}
|
|
</foreach>
|
|
</when>
|
|
</choose>
|
|
</foreach>
|
|
</trim>
|
|
</if>
|
|
</foreach>
|
|
</where>
|
|
</sql>
|
|
<sql id="Base_Column_List">
|
|
BaseKPIId, KPICode, KPIName, SuperKPIId, SuperKPICode, SysLevel, SortId, CreatedOn,
|
|
CreatedBy, ModifiedOn, ModifiedBy
|
|
</sql>
|
|
<select id="selectByExample" parameterType="com.rzyc.bean.BasekpiExample" resultMap="BaseResultMap">
|
|
select
|
|
<if test="distinct">
|
|
distinct
|
|
</if>
|
|
<include refid="Base_Column_List" />
|
|
from basekpi
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause" />
|
|
</if>
|
|
<if test="orderByClause != null">
|
|
order by ${orderByClause}
|
|
</if>
|
|
<if test="limit != null">
|
|
<if test="offset != null">
|
|
limit ${offset}, ${limit}
|
|
</if>
|
|
<if test="offset == null">
|
|
limit ${limit}
|
|
</if>
|
|
</if>
|
|
</select>
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from basekpi
|
|
where BaseKPIId = #{basekpiid,jdbcType=VARCHAR}
|
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
|
delete from basekpi
|
|
where BaseKPIId = #{basekpiid,jdbcType=VARCHAR}
|
|
</delete>
|
|
<delete id="deleteByExample" parameterType="com.rzyc.bean.BasekpiExample">
|
|
delete from basekpi
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause" />
|
|
</if>
|
|
</delete>
|
|
<insert id="insert" parameterType="com.rzyc.bean.Basekpi">
|
|
insert into basekpi (BaseKPIId, KPICode, KPIName,
|
|
SuperKPIId, SuperKPICode, SysLevel,
|
|
SortId, CreatedOn, CreatedBy,
|
|
ModifiedOn, ModifiedBy)
|
|
values (#{basekpiid,jdbcType=VARCHAR}, #{kpicode,jdbcType=VARCHAR}, #{kpiname,jdbcType=VARCHAR},
|
|
#{superkpiid,jdbcType=VARCHAR}, #{superkpicode,jdbcType=VARCHAR}, #{syslevel,jdbcType=INTEGER},
|
|
#{sortid,jdbcType=INTEGER}, #{createdon,jdbcType=TIMESTAMP}, #{createdby,jdbcType=VARCHAR},
|
|
#{modifiedon,jdbcType=TIMESTAMP}, #{modifiedby,jdbcType=VARCHAR})
|
|
</insert>
|
|
<insert id="insertSelective" parameterType="com.rzyc.bean.Basekpi">
|
|
insert into basekpi
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="basekpiid != null">
|
|
BaseKPIId,
|
|
</if>
|
|
<if test="kpicode != null">
|
|
KPICode,
|
|
</if>
|
|
<if test="kpiname != null">
|
|
KPIName,
|
|
</if>
|
|
<if test="superkpiid != null">
|
|
SuperKPIId,
|
|
</if>
|
|
<if test="superkpicode != null">
|
|
SuperKPICode,
|
|
</if>
|
|
<if test="syslevel != null">
|
|
SysLevel,
|
|
</if>
|
|
<if test="sortid != null">
|
|
SortId,
|
|
</if>
|
|
<if test="createdon != null">
|
|
CreatedOn,
|
|
</if>
|
|
<if test="createdby != null">
|
|
CreatedBy,
|
|
</if>
|
|
<if test="modifiedon != null">
|
|
ModifiedOn,
|
|
</if>
|
|
<if test="modifiedby != null">
|
|
ModifiedBy,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="basekpiid != null">
|
|
#{basekpiid,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="kpicode != null">
|
|
#{kpicode,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="kpiname != null">
|
|
#{kpiname,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="superkpiid != null">
|
|
#{superkpiid,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="superkpicode != null">
|
|
#{superkpicode,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="syslevel != null">
|
|
#{syslevel,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="sortid != null">
|
|
#{sortid,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="createdon != null">
|
|
#{createdon,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="createdby != null">
|
|
#{createdby,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="modifiedon != null">
|
|
#{modifiedon,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="modifiedby != null">
|
|
#{modifiedby,jdbcType=VARCHAR},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<select id="countByExample" parameterType="com.rzyc.bean.BasekpiExample" resultType="java.lang.Long">
|
|
select count(*) from basekpi
|
|
<if test="_parameter != null">
|
|
<include refid="Example_Where_Clause" />
|
|
</if>
|
|
</select>
|
|
<update id="updateByExampleSelective" parameterType="map">
|
|
update basekpi
|
|
<set>
|
|
<if test="record.basekpiid != null">
|
|
BaseKPIId = #{record.basekpiid,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.kpicode != null">
|
|
KPICode = #{record.kpicode,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.kpiname != null">
|
|
KPIName = #{record.kpiname,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.superkpiid != null">
|
|
SuperKPIId = #{record.superkpiid,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.superkpicode != null">
|
|
SuperKPICode = #{record.superkpicode,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.syslevel != null">
|
|
SysLevel = #{record.syslevel,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="record.sortid != null">
|
|
SortId = #{record.sortid,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="record.createdon != null">
|
|
CreatedOn = #{record.createdon,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="record.createdby != null">
|
|
CreatedBy = #{record.createdby,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="record.modifiedon != null">
|
|
ModifiedOn = #{record.modifiedon,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="record.modifiedby != null">
|
|
ModifiedBy = #{record.modifiedby,jdbcType=VARCHAR},
|
|
</if>
|
|
</set>
|
|
<if test="_parameter != null">
|
|
<include refid="Update_By_Example_Where_Clause" />
|
|
</if>
|
|
</update>
|
|
<update id="updateByExample" parameterType="map">
|
|
update basekpi
|
|
set BaseKPIId = #{record.basekpiid,jdbcType=VARCHAR},
|
|
KPICode = #{record.kpicode,jdbcType=VARCHAR},
|
|
KPIName = #{record.kpiname,jdbcType=VARCHAR},
|
|
SuperKPIId = #{record.superkpiid,jdbcType=VARCHAR},
|
|
SuperKPICode = #{record.superkpicode,jdbcType=VARCHAR},
|
|
SysLevel = #{record.syslevel,jdbcType=INTEGER},
|
|
SortId = #{record.sortid,jdbcType=INTEGER},
|
|
CreatedOn = #{record.createdon,jdbcType=TIMESTAMP},
|
|
CreatedBy = #{record.createdby,jdbcType=VARCHAR},
|
|
ModifiedOn = #{record.modifiedon,jdbcType=TIMESTAMP},
|
|
ModifiedBy = #{record.modifiedby,jdbcType=VARCHAR}
|
|
<if test="_parameter != null">
|
|
<include refid="Update_By_Example_Where_Clause" />
|
|
</if>
|
|
</update>
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.rzyc.bean.Basekpi">
|
|
update basekpi
|
|
<set>
|
|
<if test="kpicode != null">
|
|
KPICode = #{kpicode,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="kpiname != null">
|
|
KPIName = #{kpiname,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="superkpiid != null">
|
|
SuperKPIId = #{superkpiid,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="superkpicode != null">
|
|
SuperKPICode = #{superkpicode,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="syslevel != null">
|
|
SysLevel = #{syslevel,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="sortid != null">
|
|
SortId = #{sortid,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="createdon != null">
|
|
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="createdby != null">
|
|
CreatedBy = #{createdby,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="modifiedon != null">
|
|
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="modifiedby != null">
|
|
ModifiedBy = #{modifiedby,jdbcType=VARCHAR},
|
|
</if>
|
|
</set>
|
|
where BaseKPIId = #{basekpiid,jdbcType=VARCHAR}
|
|
</update>
|
|
<update id="updateByPrimaryKey" parameterType="com.rzyc.bean.Basekpi">
|
|
update basekpi
|
|
set KPICode = #{kpicode,jdbcType=VARCHAR},
|
|
KPIName = #{kpiname,jdbcType=VARCHAR},
|
|
SuperKPIId = #{superkpiid,jdbcType=VARCHAR},
|
|
SuperKPICode = #{superkpicode,jdbcType=VARCHAR},
|
|
SysLevel = #{syslevel,jdbcType=INTEGER},
|
|
SortId = #{sortid,jdbcType=INTEGER},
|
|
CreatedOn = #{createdon,jdbcType=TIMESTAMP},
|
|
CreatedBy = #{createdby,jdbcType=VARCHAR},
|
|
ModifiedOn = #{modifiedon,jdbcType=TIMESTAMP},
|
|
ModifiedBy = #{modifiedby,jdbcType=VARCHAR}
|
|
where BaseKPIId = #{basekpiid,jdbcType=VARCHAR}
|
|
</update>
|
|
|
|
<resultMap id="BaseResultMapTree" type="com.rzyc.bean.Basekpi">
|
|
<id column="BaseKPIId" jdbcType="VARCHAR" property="id" />
|
|
<result column="KPICode" jdbcType="VARCHAR" property="kpicode" />
|
|
<result column="KPIName" jdbcType="VARCHAR" property="label" />
|
|
<result column="SuperKPIId" jdbcType="VARCHAR" property="superkpiid" />
|
|
<result column="SuperKPICode" jdbcType="VARCHAR" property="superkpicode" />
|
|
<result column="SysLevel" jdbcType="INTEGER" property="syslevel" />
|
|
<result column="SortId" jdbcType="INTEGER" property="sortid" />
|
|
<result column="CreatedOn" jdbcType="TIMESTAMP" property="createdon" />
|
|
<result column="CreatedBy" jdbcType="VARCHAR" property="createdby" />
|
|
<result column="ModifiedOn" jdbcType="TIMESTAMP" property="modifiedon" />
|
|
<result column="ModifiedBy" jdbcType="VARCHAR" property="modifiedby" />
|
|
<collection property="children" ofType="com.rzyc.bean.TreeModel" column="id">
|
|
<id column="BaseKPIIdSecond" jdbcType="VARCHAR" property="id" />
|
|
<result column="KPICodeSecond" jdbcType="VARCHAR" property="code" />
|
|
<result column="KPINameSecond" jdbcType="VARCHAR" property="label" />
|
|
<result column="SuperKPIIdSecond" jdbcType="VARCHAR" property="parentId" />
|
|
<collection property="children" ofType="com.rzyc.bean.TreeModel" column="id">
|
|
<id column="BaseKPIIdThird" jdbcType="VARCHAR" property="id" />
|
|
<result column="KPICodeThird" jdbcType="VARCHAR" property="code" />
|
|
<result column="KPINameThird" jdbcType="VARCHAR" property="label" />
|
|
<result column="SuperKPIIdThird" jdbcType="VARCHAR" property="parentId" />
|
|
</collection>
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<select id="selectDPTree" resultMap="BaseResultMapTree">
|
|
select t1.BaseKPIId,t1.KPICode,t1.KPIName,
|
|
t2.SuperKPIId SuperKPIIdSecond,t2.BaseKPIId BaseKPIIdSecond,t2.KPICode KPICodeSecond,t2.KPIName KPINameSecond,
|
|
t3.SuperKPIId SuperKPIIdThird,t3.BaseKPIId BaseKPIIdThird,t3.KPICode KPICodeThird,t3.KPIName KPINameThird
|
|
from BaseKPI t1
|
|
inner join BaseKPI t2 on t1.BaseKPIId = t2.SuperKPIId
|
|
inner join BaseKPI t3 on t2.BaseKPIId = t3.SuperKPIId
|
|
</select>
|
|
|
|
<!--指标分类列表-->
|
|
<resultMap id="KpiResultMap" type="com.rzyc.bean.Basekpi">
|
|
<id column="BaseKPIId" jdbcType="VARCHAR" property="basekpiid" />
|
|
<result column="KPICode" jdbcType="VARCHAR" property="kpicode" />
|
|
<result column="KPIName" jdbcType="VARCHAR" property="kpiname" />
|
|
<result column="SuperKPIId" jdbcType="VARCHAR" property="superkpiid" />
|
|
<result column="SuperKPICode" jdbcType="VARCHAR" property="superkpicode" />
|
|
<result column="SysLevel" jdbcType="INTEGER" property="syslevel" />
|
|
<result column="SortId" jdbcType="INTEGER" property="sortid" />
|
|
<result column="CreatedOn" jdbcType="TIMESTAMP" property="createdon" />
|
|
<result column="CreatedBy" jdbcType="VARCHAR" property="createdby" />
|
|
<result column="ModifiedOn" jdbcType="TIMESTAMP" property="modifiedon" />
|
|
<result column="ModifiedBy" jdbcType="VARCHAR" property="modifiedby" />
|
|
</resultMap>
|
|
|
|
<!--指标分类列表-->
|
|
<select id="findByName" resultMap="KpiResultMap">
|
|
SELECT sp.`KPIName` superName,bk.*
|
|
FROM `BaseKPI` bk
|
|
LEFT JOIN BaseKPI sp ON bk.`SuperKPIId` = sp.`BaseKPIId`
|
|
WHERE bk.`KPIName` LIKE #{condition}
|
|
ORDER BY bk.`KPICode` ASC
|
|
</select>
|
|
</mapper>
|