| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?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.hotent.baseInfo.dao.CostDocumentTemplateFileDao">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.hotent.baseInfo.model.CostDocumentTemplateFile">
- <id column="id" property="id" />
- <result column="original_text" property="originalText" />
- <result column="pinyin" property="pinyin" />
- <result column="document_id" property="documentId" />
- <result column="label_value" property="labelValue" />
- <result column="table_name" property="tableName" />
- <result column="col_name" property="colName" />
- <result column="where_name" property="whereName"/>
- <result column="where_value" property="whereValue"/>
- <result column="status" property="status" />
- <result column="is_deleted" property="isDeleted" />
- <result column="create_time" property="createTime" />
- <result column="create_by" property="createBy" />
- <result column="update_time" property="updateTime" />
- <result column="update_by" property="updateBy" />
- <result column="remark" property="remark" />
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, original_text, pinyin, document_id, where_name,where_value, label_value, table_name, col_name, status, is_deleted, create_time, create_by, update_time, update_by, remark
- </sql>
- <select id="selectPage" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List"/>
- from
- cost_document_template_file
- ${ew.customSqlSegment}
- </select>
-
- <select id="selectList" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List"/>
- from
- cost_document_template_file
- ${ew.customSqlSegment}
- </select>
-
- <select id="selectById" resultMap="BaseResultMap">
- select
- <include refid="Base_Column_List"/>
- from
- cost_document_template_file
- where
- id = ${id}
- </select>
- <select id="tableExists" resultType="java.lang.Integer">
- select count(1) from information_schema.columns where table_name = #{tableName}
- </select>
- <select id="colExists" resultType="java.lang.Integer">
- select count(1) from information_schema.columns where table_name = #{tableName} and column_name = #{colName}
- </select>
- <select id="getColValue" resultType="java.lang.String">
- select
- ${colName}
- from
- ${tableName}
- where
- ${whereName} = ${whereValue}
- </select>
- <select id="getColValue2" resultType="java.lang.String">
- ${tableName}
- </select>
- <select id="getSurveyTemplate" resultType="java.util.HashMap">
- WITH ranked_data AS (
- SELECT
- *,
- ROW_NUMBER() OVER (PARTITION BY rowid ORDER BY id ASC) as position
- FROM cost_survey_template_upload_data
- WHERE task_id = #{id}
- AND parent_id = -1
- )
- SELECT
- a.rkey, b.rvalue xm, a.rvalue
- FROM ranked_data a
- INNER JOIN ranked_data b ON a.rowid = b.rowid
- WHERE a.rkey LIKE '%核定值%'
- AND b.position = 2
- ORDER BY
- b.rvalue, -- 按项目名称排序
- a.rkey;
- </select>
- </mapper>
|