You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
3.6 KiB
110 lines
3.6 KiB
<?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.hxgk.lowcode.mapper.FieldRecordMapper">
|
|
|
|
<select id="getFieldRecord" resultType="com.hxgk.lowcode.model.entity.CustomerFormTableSingleFieldValue" parameterType="java.lang.String" statementType="STATEMENT">
|
|
|
|
select id as value,${fieldKey} as label from ${formIdOrTableKey} where states = 1
|
|
|
|
</select>
|
|
|
|
<select id="getDataTitles" resultType="java.util.TreeMap" statementType="STATEMENT">
|
|
|
|
select id as value,
|
|
|
|
<foreach collection="fields" index="index" item="item" separator="," >
|
|
${item}
|
|
</foreach>
|
|
|
|
from ${asfFormName} where states = 1
|
|
|
|
</select>
|
|
<select id="getDataTitlesByIds" resultType="java.util.TreeMap" statementType="STATEMENT">
|
|
|
|
select id as value,
|
|
|
|
<foreach collection="fields" index="index" item="item" separator="," >
|
|
${item}
|
|
</foreach>
|
|
|
|
from ${asfFormName} where states = 1 and
|
|
id in
|
|
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")" >
|
|
${item}
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
<select id="checkFieldExists" resultType="boolean">
|
|
SELECT
|
|
CASE
|
|
WHEN EXISTS (
|
|
SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS
|
|
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = #{tableName} AND COLUMN_NAME = #{fieldName}
|
|
) THEN 1
|
|
ELSE 0
|
|
END AS existsFlag
|
|
</select>
|
|
|
|
|
|
<select id="getDataTitlesWithWhere_Asf_NotTable" resultType="java.util.TreeMap" statementType="STATEMENT">
|
|
|
|
select id as value,
|
|
|
|
<foreach collection="fields" index="index" item="item" separator="," >
|
|
${item}
|
|
</foreach>
|
|
|
|
from ${asfFormName} where states = 1
|
|
|
|
<if test="operator!= null and operator!= '' and whereCondition != null and whereCondition != '' and leftField != null and leftField != ''">
|
|
AND ${leftField} ${operator} ${whereCondition}
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getDataTitlesWithWhere_Master_NotTable" resultType="java.util.TreeMap" statementType="STATEMENT">
|
|
|
|
SELECT
|
|
DISTINCT asf.id AS value,
|
|
<foreach collection="fields" index="index" item="item" separator="," >
|
|
${item}
|
|
</foreach>
|
|
from
|
|
${asfFormName} asf
|
|
left join
|
|
${masterFormName} master on
|
|
asf.id = master.${masterOnField}
|
|
where asf.states = 1 and master.states = 1
|
|
<if test="whereConditionField!= null and whereConditionField!= '' and operator != null and operator != '' and whereConditionValue != null and whereConditionValue != ''">
|
|
AND ${whereConditionField} ${operator} ${whereConditionValue}
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
<select id="getDataTitlesWithWhere_Master_IsTable" resultType="java.util.TreeMap" statementType="STATEMENT">
|
|
|
|
SELECT
|
|
DISTINCT parent.id AS value,
|
|
<foreach collection="fields" index="index" item="item" separator="," >
|
|
${item}
|
|
</foreach>
|
|
from
|
|
${parent} parent
|
|
left join
|
|
${child} child on
|
|
parent.masters_key = child.masters_key
|
|
where parent.states = 1 and child.states = 1
|
|
<if test="whereConditionField!= null and whereConditionField!= '' and operator != null and operator != '' and whereConditionValue != null and whereConditionValue != ''">
|
|
AND child.${whereConditionField} ${operator} ${whereConditionValue}
|
|
</if>
|
|
|
|
|
|
</select>
|
|
|
|
</mapper>
|