95 lines
4.7 KiB
XML
95 lines
4.7 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.common.mapper.DmColumnMapper">
|
||
|
|
|
||
|
|
<resultMap id="BaseResultMap" type="com.common.entity.DmColumn">
|
||
|
|
|
||
|
|
<id column="id" property="id" jdbcType="BIGINT"/>
|
||
|
|
<result column="created_at" property="createdAt"/>
|
||
|
|
<result column="updated_at" property="updatedAt" />
|
||
|
|
<result column="deleted_at" property="deletedAt" />
|
||
|
|
<result column="name" property="name" jdbcType="VARCHAR"/>
|
||
|
|
<result column="display_name" property="displayName" jdbcType="VARCHAR"/>
|
||
|
|
<result column="storage_data_type" property="storageDataType" jdbcType="BIGINT"/>
|
||
|
|
<result column="business_data_type" property="businessDataType" jdbcType="BIGINT"/>
|
||
|
|
<result column="is_built_in" property="isBuiltIn" jdbcType="BOOLEAN"/>
|
||
|
|
<result column="is_hidden" property="isHidden" jdbcType="BOOLEAN"/>
|
||
|
|
<result column="is_not_normalizable" property="isNotNormalizable" jdbcType="BOOLEAN"/>
|
||
|
|
<result column="is_required" property="isRequired" jdbcType="BOOLEAN"/>
|
||
|
|
<result column="category_id" property="categoryId" jdbcType="INTEGER"/>
|
||
|
|
<result column="custom_asset_category_id" property="customAssetCategoryId" jdbcType="INTEGER"/>
|
||
|
|
<result column="is_virtual" property="isVirtual" jdbcType="BOOLEAN"/>
|
||
|
|
<result column="table_id" property="tableId" jdbcType="INTEGER"/>
|
||
|
|
<result column="asset_table_id" property="assetTableId" jdbcType="INTEGER"/>
|
||
|
|
<result column="column_set_id" property="columnSetId" jdbcType="INTEGER"/>
|
||
|
|
<result column="base_type" property="baseType" jdbcType="INTEGER"/>
|
||
|
|
<result column="user_task_id" property="userTaskId" jdbcType="INTEGER"/>
|
||
|
|
<result column="created_by_id" property="createdById" jdbcType="BIGINT"/>
|
||
|
|
<result column="create_dept" property="createDept" jdbcType="BIGINT"/>
|
||
|
|
<result column="create_by" property="createBy" jdbcType="BIGINT"/>
|
||
|
|
<result column="create_time" property="createTime"/>
|
||
|
|
<result column="update_by" property="updateBy" jdbcType="BIGINT"/>
|
||
|
|
<result column="update_time" property="updateTime"/>
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<!-- 条件查询 -->
|
||
|
|
<select id="findByCondition" parameterType="com.common.entity.DmColumn" resultMap="BaseResultMap">
|
||
|
|
SELECT * FROM dm_column
|
||
|
|
WHERE deleted_at IS NULL
|
||
|
|
<if test="name != null and name != ''">
|
||
|
|
AND name = #{name}
|
||
|
|
</if>
|
||
|
|
<if test="displayName != null and displayName != ''">
|
||
|
|
AND display_name LIKE CONCAT('%', #{displayName}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="isBuiltIn != null">
|
||
|
|
AND is_built_in = #{isBuiltIn}
|
||
|
|
</if>
|
||
|
|
<if test="isHidden != null">
|
||
|
|
AND is_hidden = #{isHidden}
|
||
|
|
</if>
|
||
|
|
<if test="isRequired != null">
|
||
|
|
AND is_required = #{isRequired}
|
||
|
|
</if>
|
||
|
|
<if test="categoryId != null">
|
||
|
|
AND category_id = #{categoryId}
|
||
|
|
</if>
|
||
|
|
<if test="tableId != null">
|
||
|
|
AND table_id = #{tableId}
|
||
|
|
</if>
|
||
|
|
ORDER BY id DESC
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
<select id="findById" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
||
|
|
SELECT Id, created_at::timestamp as created_at ,
|
||
|
|
updated_at::timestamp as updated_at , deleted_at::timestamp as deleted_at , name, display_name,
|
||
|
|
storage_data_type, business_data_type, is_built_in, is_hidden,
|
||
|
|
is_not_normalizable, is_required, category_id, custom_asset_category_id,
|
||
|
|
is_virtual, table_id, asset_table_id, column_set_id, base_type,
|
||
|
|
user_task_id, created_by_id, create_dept, create_by, create_time::timestamp as create_time ,
|
||
|
|
update_by, update_time::timestamp as update_time
|
||
|
|
FROM dm_column
|
||
|
|
WHERE id = #{id} AND deleted_at IS NULL
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
<!-- 查询全部正常字段-->
|
||
|
|
|
||
|
|
<select id="selectAllNormal" parameterType="java.lang.Long" resultType="java.util.LinkedHashMap">
|
||
|
|
SELECT Id, created_at::timestamp as created_at ,
|
||
|
|
updated_at::timestamp as updated_at , deleted_at::timestamp as deleted_at , name, display_name,
|
||
|
|
storage_data_type, business_data_type, is_built_in, is_hidden,
|
||
|
|
is_not_normalizable, is_required, category_id, custom_asset_category_id,
|
||
|
|
is_virtual, table_id, asset_table_id, column_set_id, base_type,
|
||
|
|
user_task_id, created_by_id, create_dept, create_by, create_time::timestamp as create_time ,
|
||
|
|
update_by, update_time::timestamp as update_time
|
||
|
|
FROM dm_column
|
||
|
|
where deleted_at is null and id in ( select distinct column_id from dm_field_table_column where deleted_at is null
|
||
|
|
)
|
||
|
|
</select>
|
||
|
|
|
||
|
|
</mapper>
|