<?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.qianwen.smartman.modules.system.mapper.CustomTemplateFieldMapper">
|
|
<select id="getSelectBox" resultType="com.qianwen.smartman.modules.system.vo.CustomFieldRelationInfoVO">
|
SELECT tf.id fieldId,
|
tf.field_name fieldName,
|
tf.field_code fieldCode,
|
tf.modify_field_code modifyFieldCode,
|
tf.field_type fieldType,
|
tf.property_json propertyJson,
|
tf.system_field systemField,
|
tf.sys_field_must sysFieldMust,
|
tfr.sort,
|
tfr.id relationId
|
FROM blade_custom_template_field tf
|
LEFT JOIN blade_custom_field_relation tfr ON tf.id = tfr.field_id
|
AND tfr.template_id = #{templateId}
|
AND tfr.config_type = #{configType}
|
AND tfr.is_deleted = 0
|
WHERE tf.is_deleted = 0
|
and tf.business_type = #{businessType}
|
<if test="configType == 1 ">
|
and tf.add_show=1
|
</if>
|
<if test="configType == 2 ">
|
and tf.update_show=1
|
</if>
|
<if test="configType == 3 ">
|
and tf.view_show=1
|
</if>
|
<if test="_databaseId=='mysql'">
|
ORDER BY tfr.sort is null,tfr.sort,tf.id ASC
|
</if>
|
<if test="_databaseId=='dm'">
|
ORDER BY tfr.sort nulls last,tf.id ASC
|
</if>
|
<if test="_databaseId=='oracle'">
|
ORDER BY tfr.sort,tf.id ASC
|
</if>
|
</select>
|
|
<select id="listField" resultType="com.qianwen.smartman.modules.system.vo.CustomTemplateFieldListVO">
|
SELECT tf.id fieldId,
|
tf.field_name fieldName,
|
tf.sys_field_must sysFieldMust,
|
tf.field_description fieldDescription,
|
tf.default_value defaultValue,
|
tfr.must_field mustField,
|
tf.support_update supportUpdate,
|
tf.system_field systemField,
|
tfr.id id,
|
tfr.config_type
|
FROM blade_custom_field_relation tfr
|
LEFT JOIN blade_custom_template_field tf ON tfr.field_id = tf.id
|
WHERE tfr.is_deleted = 0
|
and tf.id is not null
|
AND tfr.template_id = #{templateId}
|
<if test="configType != null ">
|
AND tfr.config_type = #{configType}
|
</if>
|
ORDER BY tfr.sort ASC
|
</select>
|
<!--根据模版id获取绑定的字段信息-->
|
<select id="getColumns" resultType="com.qianwen.smartman.modules.system.dto.CustomTemplateColumnDTO">
|
SELECT
|
ct.id as templateId,
|
ct.template_name as templateName,
|
tf.id as fieldId,
|
tf.field_name as fieldName,
|
tf.field_code as fieldCode,
|
tf.modify_field_code as modifyFieldCode,
|
tf.query_field_code as queryFieldCode,
|
tf.field_description as fieldDescription,
|
tf.field_type as fieldType,
|
tf.property_json as propertyJson,
|
tf.system_field as systemField,
|
tf.sys_field_must as sysFieldMust,
|
tf.default_value as defaultValue,
|
tf.support_query as supportQuery,
|
tf.support_update as supportUpdate,
|
tf.support_export as supportExport,
|
tfr.must_field as mustField
|
FROM
|
blade_custom_template_field tf
|
LEFT JOIN blade_custom_field_relation tfr ON tfr.field_id = tf.id
|
LEFT JOIN blade_custom_template ct ON ct.id = tfr.template_id
|
where
|
tf.is_deleted=0
|
and tfr.is_deleted=0 and tf.is_deleted=0
|
<choose>
|
<when test="templateId !=null">
|
and ct.id=#{templateId}
|
</when>
|
<otherwise>
|
and tf.business_type=2
|
and ct.id is not null
|
</otherwise>
|
</choose>
|
AND tfr.config_type=#{configType} ORDER BY tfr.sort ASC
|
</select>
|
</mapper>
|