123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <?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.ReportDao">
- <sql id="reportColumns">
- a.id AS "id",
- a.report_title AS "reportTitle",
- a.des AS "des",
- a.publish_time AS "publishTime",
- a.report_path AS "reportPath",
- a.dept_id AS "deptId",
- a.create_time AS "createTime",
- a.create_by AS "createBy",
- a.update_time AS "updateTime",
- a.update_by AS "updateBy"
- </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="Report">
- SELECT
- <include refid="reportColumns"/>
- FROM public.{table.name} a
- WHERE a.id = #{id}
- </select>
- <select id="findList" resultType="Report">
- SELECT
- <include refid="reportColumns"/>
- FROM public.report 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="Report">
- SELECT
- <include refid="reportColumns"/>
- FROM public.report 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,
- report_title,
- des,
- publish_time,
- report_path,
- dept_id,
- create_time,
- update_time
- </sql>
- <insert id="insert">
- <selectKey keyProperty="id" resultType="String" order="BEFORE">
- <choose>
- <when test="id == null or id == ''">
- select get_next_id('report','') from dual
- </when>
- <otherwise>
- select #{id} from dual
- </otherwise>
- </choose>
- </selectKey>
- INSERT INTO report(
- <include refid="insertColumns"/>
- ) VALUES (
- #{id
- , jdbcType=VARCHAR
- },
- #{reportTitle
- , jdbcType=VARCHAR
- },
- #{des
- , jdbcType=VARCHAR
- },
- #{publishTime
- },
- #{reportPath
- , jdbcType=VARCHAR
- },
- #{deptId
- , jdbcType=VARCHAR
- },
- #{createTime
- },
- #{updateTime
- }
- )
- </insert>
- <insert id="insertList">
- INSERT INTO report(
- <include refid="insertColumns"/>
- ) select FFF.* from (
- <foreach collection="list" item="item" index="index" separator="UNION ALL" >
- select
- #{item.id, jdbcType=VARCHAR} as "id",
- #{item.reportTitle, jdbcType=VARCHAR} as "reportTitle",
- #{item.des, jdbcType=VARCHAR} as "des",
- #{item.publishTime} as "publishTime",
- #{item.reportPath, jdbcType=VARCHAR} as "reportPath",
- #{item.deptId, jdbcType=VARCHAR} as "deptId",
- #{item.createTime} as "createTime",
- #{item.updateTime} as "updateTime"
- from dual
- </foreach>
- ) FFF
- </insert>
- <update id="update">
- UPDATE report SET
- id = #{id},
- report_title = #{reportTitle},
- des = #{des},
- publish_time = #{publishTime},
- report_path = #{reportPath},
- dept_id = #{deptId},
- create_time = #{createTime},
- update_time = #{updateTime},
- update_by = #{updateBy}
- WHERE id = #{id, jdbcType=VARCHAR}
- </update>
- <update id="delete">
- DELETE FROM public.report
- WHERE
- <choose>
- <when test="id != null and id != ''">
- id = #{id, jdbcType=VARCHAR}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </update>
- </mapper>
|