123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- <?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.ims.eval.dao.IndicatorDao">
- <sql id="indicatorColumns">
- a.id AS "id",
- a.indicator_name AS "indicatorName",
- a.indicator_cede AS "indicatorCede",
- a.unit AS "unit",
- a.is_quantified AS "isQuantified",
- a.is_additional AS "isAdditional",
- a.des AS "des",
- a.bin_section AS "binSection",
- a.bin_stage AS "binStage",
- a.dept AS "dept",
- a.company AS "company",
- a.enable AS "enable",
- a.create_time AS "createTime",
- a.update_time AS "updateTime",
- a.create_by AS "createBy",
- a.update_by AS "updateBy",
- a.remark AS "remark",
- a.order_num AS "orderNum"
- </sql>
- <sql id="whereStr">
- 1=1
- <!-- 快速定位 -->
- <if test="sqlMap.key != null and sqlMap.key != ''">
- AND (
- )
- </if>
- <!-- 高级查询dataFilter -->
- <if test="sqlMap.df != null and sqlMap.df != ''">
- AND ( ${sqlMap.df} )
- </if>
- <!-- 默认查询baseFilter -->
- <if test="sqlMap.bf != null and sqlMap.bf != ''">
- AND ( ${sqlMap.bf} )
- </if>
- <!-- 基本Query查询 -->
- <if test="sqlMap.baseQuery != null and sqlMap.baseQuery != ''">
- AND ( ${sqlMap.baseQuery} )
- </if>
- <!-- 特定Query查询 -->
- <if test="sqlMap.specQuery != null and sqlMap.specQuery != ''">
- AND ( ${sqlMap.specQuery} )
- </if>
- <if test="sqlMap.dsf != null and sqlMap.dsf != ''">
- AND (${sqlMap.dsf})
- </if>
- </sql>
- <select id="get" resultType="Indicator">
- SELECT
- <include refid="indicatorColumns"/>
- FROM public.{table.name} a
- WHERE a.id = #{id}
- </select>
- <select id="findList" resultType="Indicator">
- SELECT
- <include refid="indicatorColumns"/>
- FROM public.indicator a
- <where>
- <include refid="whereStr"/>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="Indicator">
- SELECT
- <include refid="indicatorColumns"/>
- FROM public.indicator a
- <where>
- <include refid="whereStr"/>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <sql id="insertColumns">
- id,
- indicator_name,
- indicator_cede,
- unit,
- is_quantified,
- is_additional,
- des,
- bin_section,
- bin_stage,
- dept,
- company,
- enable,
- create_time,
- update_time,
- remark,
- order_num
- </sql>
- <insert id="insert">
- <selectKey keyProperty="id" resultType="String" order="BEFORE">
- <choose>
- <when test="id == null or id == ''">
- select get_next_id('indicator','') from dual
- </when>
- <otherwise>
- select #{id} from dual
- </otherwise>
- </choose>
- </selectKey>
- INSERT INTO indicator(
- <include refid="insertColumns"/>
- ) VALUES (
- #{id
- , jdbcType=VARCHAR
- },
- #{indicatorName
- , jdbcType=VARCHAR
- },
- #{indicatorCede
- , jdbcType=VARCHAR
- },
- #{unit
- , jdbcType=VARCHAR
- },
- #{isQuantified
- , jdbcType=VARCHAR
- },
- #{isAdditional
- , jdbcType=VARCHAR
- },
- #{des
- , jdbcType=VARCHAR
- },
- #{binSection
- , jdbcType=VARCHAR
- },
- #{binStage
- , jdbcType=VARCHAR
- },
- #{dept
- , jdbcType=VARCHAR
- },
- #{company
- , jdbcType=VARCHAR
- },
- #{enable
- },
- #{createTime
- },
- #{updateTime
- },
- #{remark
- , jdbcType=VARCHAR
- },
- #{orderNum
- }
- )
- </insert>
- <insert id="insertList">
- INSERT INTO indicator(
- <include refid="insertColumns"/>
- ) select FFF.* from (
- <foreach collection="list" item="item" index="index" separator="UNION ALL" >
- select
- #{item.id, jdbcType=VARCHAR} as "id",
- #{item.indicatorName, jdbcType=VARCHAR} as "indicatorName",
- #{item.indicatorCede, jdbcType=VARCHAR} as "indicatorCede",
- #{item.unit, jdbcType=VARCHAR} as "unit",
- #{item.isQuantified, jdbcType=VARCHAR} as "isQuantified",
- #{item.isAdditional, jdbcType=VARCHAR} as "isAdditional",
- #{item.des, jdbcType=VARCHAR} as "des",
- #{item.binSection, jdbcType=VARCHAR} as "binSection",
- #{item.binStage, jdbcType=VARCHAR} as "binStage",
- #{item.dept, jdbcType=VARCHAR} as "dept",
- #{item.company, jdbcType=VARCHAR} as "company",
- #{item.enable} as "enable",
- #{item.createTime} as "createTime",
- #{item.updateTime} as "updateTime",
- #{item.remark, jdbcType=VARCHAR} as "remark",
- #{item.orderNum} as "orderNum"
- from dual
- </foreach>
- ) FFF
- </insert>
- <update id="update">
- UPDATE indicator SET
- id = #{id},
- indicator_name = #{indicatorName},
- indicator_cede = #{indicatorCede},
- unit = #{unit},
- is_quantified = #{isQuantified},
- is_additional = #{isAdditional},
- des = #{des},
- bin_section = #{binSection},
- bin_stage = #{binStage},
- dept = #{dept},
- company = #{company},
- enable = #{enable},
- create_time = #{createTime},
- update_time = #{updateTime},
- update_by = #{updateBy},
- remark = #{remark},
- order_num = #{orderNum}
- WHERE id = #{id, jdbcType=VARCHAR}
- </update>
- <update id="delete">
- DELETE FROM public.indicator
- WHERE
- <choose>
- <when test="id != null and id != ''">
- id = #{id, jdbcType=VARCHAR}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </update>
- </mapper>
|