<?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="cn.autoform.web.mapper.datamanagement.DataManagementMapper">
|
|
<select id="getUserName" resultType="java.lang.String">
|
/*!mycat:sql=select tenantid from FORMDATAMANAGER WHERE TENANTID = '${tenantID}' AND FROMID = '${formID}' */
|
select createUser from
|
FORMDATA_${tenantID}_${formID}
|
WHERE
|
TENANTID = #{tenantID}
|
AND dataRowNum = #{dataRowNum}
|
</select>
|
|
<select id="getsubFormFieldCount" resultType="java.lang.Integer">
|
SELECT
|
COUNT(0)
|
FROM
|
formfield
|
WHERE
|
FORMID = #{formID}
|
AND TENANTID = #{tenantID}
|
AND FIELDTYPE != "subform"
|
AND PARENTSUBFORMNUM != 0
|
</select>
|
<select id="getFormContext" resultType="java.util.Map">
|
SELECT
|
formset.BUSSINESSSYSTEM,
|
formset.CREATEDATETIME,
|
formset.CREATEUSER
|
FROM
|
formset,
|
formversion
|
WHERE
|
formset.FORMSETID = formversion.FORMSETID
|
AND formversion.FORMID = #{formID}
|
AND formversion.TENANTID = #{tenantID}
|
</select>
|
|
<select id="getFormDataContext" resultType="java.util.Map">
|
SELECT
|
mainForm.CREATEDATETIME as createDateTime,
|
mainForm.CREATEUSER as createUser,
|
mainForm.ENCLOSUREINFO as enclosureInfo,
|
process.process_state as processState
|
FROM
|
${formName} AS mainForm
|
LEFT JOIN process_log AS process
|
ON process.FORMID = #{formID}
|
AND process.tenant_id = mainForm.TENANTID
|
AND process.DATAROWNUM = mainForm.DATAROWNUM
|
WHERE
|
mainForm.DATAROWNUM = #{datarowNum}
|
AND mainForm.TENANTID = #{tenantID}
|
</select>
|
|
<select id="queryFormFieldPropertyByFieldKey" resultType="cn.autoform.db.entity.FormFieldEntity">
|
SELECT
|
`COLUMNORDERNUM`,
|
`FIELDKEY`
|
FROM
|
formfield
|
WHERE
|
FORMID = #{formID}
|
AND TENANTID = #{tenantID}
|
AND FIELDKEY = #{fieldKey}
|
</select>
|
|
<select id="queryFormFieldProperty" resultType="cn.autoform.db.entity.FieldPropertyEntity">
|
SELECT
|
`FORMID`,
|
`TENANTID`,
|
`COLUMNORDERNUM`,
|
`PROPERTY`,
|
`VALUE`,
|
`DELETEFLG`,
|
`CREATEUSER`,
|
`CREATEDATETIME`,
|
`UPDATEUSER`,
|
`UPDATEDATETIME`
|
FROM
|
fieldproperty
|
WHERE
|
FORMID = #{formID}
|
AND TENANTID = #{tenantID}
|
AND COLUMNORDERNUM = #{columnOrderNum}
|
</select>
|
|
<select id="queryFormFieldPropertyByField" resultType="cn.autoform.db.entity.FieldPropertyEntity">
|
SELECT
|
f1.`FORMID`,
|
f1.`TENANTID`,
|
f1.`COLUMNORDERNUM`,
|
f1.`PROPERTY`,
|
f1.`VALUE`,
|
f1.`DELETEFLG`,
|
f1.`CREATEUSER`,
|
f1.`CREATEDATETIME`,
|
f1.`UPDATEUSER`,
|
f1.`UPDATEDATETIME`
|
FROM
|
fieldproperty f1
|
left join formfield f2 on f1.COLUMNORDERNUM = f2.COLUMNORDERNUM and f2.FORMID = f1.FORMID and f2.TENANTID = f1.TENANTID
|
WHERE
|
f1.FORMID = #{formID}
|
AND f1.TENANTID = #{tenantID}
|
AND f2.FIELDKEY = #{field}
|
</select>
|
|
<select id="queryFormMainField" resultType="cn.autoform.db.entity.FormFieldEntity">
|
SELECT
|
`TENANTID`,
|
`FORMID`,
|
`COLUMNORDERNUM`,
|
`FIELDTYPE`,
|
`PARENTSUBFORMNUM`,
|
`FIELDORDERNUM`,
|
`FIELDKEY`,
|
`DELETEFLG`,
|
`CREATEUSER`,
|
`CREATEDATETIME`,
|
`UPDATEUSER`,
|
`UPDATEDATETIME`,
|
`FIELDISSHOW`,
|
`SEARCHISSHOW`
|
FROM
|
FORMFIELD
|
WHERE
|
FORMID = #{formID}
|
AND TENANTID = #{tenantID}
|
AND PARENTSUBFORMNUM = 0
|
AND DELETEFLG = 0
|
AND FIELDTYPE IN (
|
'radio',
|
'dropdownlist',
|
'checkbox',
|
'tree'
|
);
|
|
|
</select>
|
|
<select id="queryFormSubField" resultType="cn.autoform.db.entity.FormFieldEntity">
|
SELECT
|
`TENANTID`,
|
`FORMID`,
|
`COLUMNORDERNUM`,
|
`FIELDTYPE`,
|
`PARENTSUBFORMNUM`,
|
`FIELDORDERNUM`,
|
`FIELDKEY`,
|
`DELETEFLG`,
|
`CREATEUSER`,
|
`CREATEDATETIME`,
|
`UPDATEUSER`,
|
`UPDATEDATETIME`,
|
`FIELDISSHOW`,
|
`SEARCHISSHOW`
|
FROM
|
FORMFIELD
|
WHERE
|
FORMID = #{formID}
|
AND TENANTID = #{tenantID}
|
AND PARENTSUBFORMNUM != 0
|
AND DELETEFLG = 0
|
AND FIELDTYPE IN (
|
'radio',
|
'dropdownlist',
|
'checkbox',
|
'tree'
|
);
|
|
|
</select>
|
|
<select id="queryFormAllField" resultType="cn.autoform.db.entity.FormFieldEntity">
|
SELECT
|
`TENANTID`,
|
`FORMID`,
|
`COLUMNORDERNUM`,
|
`FIELDTYPE`,
|
`PARENTSUBFORMNUM`,
|
`FIELDORDERNUM`,
|
`FIELDKEY`,
|
`DELETEFLG`,
|
`CREATEUSER`,
|
`CREATEDATETIME`,
|
`UPDATEUSER`,
|
`UPDATEDATETIME`,
|
`FIELDISSHOW`,
|
`SEARCHISSHOW`
|
FROM
|
FORMFIELD
|
WHERE
|
FORMID = #{formID}
|
AND TENANTID = #{tenantID}
|
AND PARENTSUBFORMNUM = 0
|
AND DELETEFLG = 0
|
</select>
|
|
<select id="getBaseTableName" resultType="java.lang.String">
|
SELECT
|
m.FORMDATATABLE
|
FROM
|
formdatamanager m
|
WHERE
|
m.FORMID = #{formID}
|
AND m.SUBFORMFLG = 0
|
AND tenantID = #{tenantID}
|
</select>
|
|
<select id="queryCloudMainValue" resultType="java.lang.String">
|
${excuteSql}
|
</select>
|
|
<select id="queryFormDataPage" resultType="java.util.Map">
|
{mycat}
|
select
|
DATAROWNUM,processState,processLog,processTask,processUser
|
<if test="arrays.length > 0">
|
,
|
</if>
|
<foreach collection="arrays" item="field" separator=",">
|
${field.fieldKey}
|
</foreach>
|
from {formname}
|
where deleteFlg = 0
|
and TENANTID = '{tenantId}'
|
<if test="where != null and where != ''">
|
and ${where}
|
</if>
|
order by DATAROWNUM desc
|
</select>
|
|
<select id="queryAutoAttr" resultType="java.util.Map">
|
SELECT
|
PROPERTY,
|
`VALUE`
|
FROM
|
FIELDPROPERTY
|
WHERE
|
FORMID = #{formID}
|
|
AND TENANTID = #{tenantID}
|
|
AND PROPERTY IN (
|
'prefix',
|
'suffix',
|
'generationLength',
|
'gengerate'
|
)
|
</select>
|
|
<select id="queryCodeAutoAttr" resultType="java.util.Map">
|
SELECT
|
PROPERTY,
|
`VALUE`
|
FROM
|
FIELDPROPERTY
|
WHERE
|
FORMID = #{formID}
|
|
AND TENANTID = #{tenantID}
|
|
AND COLUMNORDERNUM = #{columnordernum}
|
|
AND PROPERTY IN (
|
'autoType',
|
'autoTypeNumber',
|
'autoTypePrefix'
|
)
|
</select>
|
|
<select id="checkFormId" resultType="java.lang.Integer">
|
SELECT
|
count(FORMID)
|
FROM
|
FORMDATAMANAGER
|
WHERE
|
FORMID = #{formID}
|
AND TENANTID = #{tenantID}
|
</select>
|
|
<select id="queryFormFields" resultType="cn.autoform.db.entity.FormFieldEntity">
|
select
|
formfield.formid as formid,
|
formfield.tenantid as tenantid,
|
formfield.columnordernum as columnordernum,
|
case when fieldproperty.value = 'password' then 'password' else formfield.fieldtype end as fieldtype,
|
formfield.parentsubformnum as parentsubformnum,
|
formfield.fieldordernum as fieldordernum,
|
formfield.fieldkey as fieldkey,
|
fieldproperty.value as value,
|
formbase.fieldset
|
from
|
formfield
|
left join fieldproperty
|
on
|
formfield.formid = fieldproperty.formid
|
and formfield.tenantid = fieldproperty.tenantid
|
and formfield.columnordernum = fieldproperty.columnordernum
|
and (fieldproperty.property = 'datatype' or fieldproperty.property = 'format' or fieldproperty.property = 'chooseForm')
|
and fieldproperty.deleteflg = '0'
|
left join formbase
|
on
|
formfield.formid = formbase.formid
|
and formfield.tenantid = formbase.tenantid
|
where
|
formfield.formid = #{formID} and
|
formfield.tenantid = #{tenantID} and
|
formfield.deleteflg = '0'
|
order by formfield.fieldordernum
|
</select>
|
|
<select id="getFormFieldMain" resultType="cn.autoform.db.entity.FormFieldEntity">
|
SELECT
|
formfield.formid AS formid,
|
formfield.tenantid AS tenantid,
|
formfield.columnordernum AS columnordernum,
|
CASE
|
WHEN fieldproperty.
|
VALUE
|
= 'password' THEN
|
'password'
|
ELSE
|
formfield.fieldtype
|
END AS fieldtype,
|
formfield.parentsubformnum AS parentsubformnum,
|
formfield.fieldordernum AS fieldordernum,
|
formfield.fieldkey AS fieldkey,
|
fieldproperty.
|
VALUE
|
AS
|
VALUE
|
|
FROM
|
formfield
|
LEFT JOIN fieldproperty ON formfield.formid = fieldproperty.formid
|
AND formfield.tenantid = fieldproperty.tenantid
|
AND formfield.columnordernum = fieldproperty.columnordernum
|
AND (
|
fieldproperty.property = 'datatype'
|
OR fieldproperty.property = 'format'
|
)
|
AND fieldproperty.deleteflg = '0'
|
WHERE
|
formfield.formid = #{formID}
|
AND formfield.tenantid = #{tenantID}
|
AND formfield.deleteflg = '0'
|
AND formfield.FIELDTYPE != 'subform'
|
AND formfield.PARENTSUBFORMNUM = 0
|
ORDER BY
|
formfield.fieldordernum
|
</select>
|
|
<select id="queryFormFieldsAboutData" resultType="cn.autoform.db.entity.FieldPropertyEntity">
|
SELECT
|
PROPERTY,
|
VALUE
|
FROM
|
FIELDPROPERTY
|
WHERE
|
FIELDPROPERTY.FORMID = #{formID} AND
|
FIELDPROPERTY.TENANTID = #{tenantID} AND
|
FIELDPROPERTY.COLUMNORDERNUM = #{columnOrderNum} AND
|
FIELDPROPERTY.PROPERTY IN ('datasourcetype','custom','datasource','masterData','apiUrl','textcolumn','valuecolumn','namecolumn','apiIdKey','apiPIdKey') AND
|
FIELDPROPERTY.DELETEFLG = '0'
|
</select>
|
|
<update id = "updateFormFieldState" parameterType="cn.autoform.db.entity.FormFieldEntity">
|
UPDATE
|
FORMFIELD
|
SET
|
FIELDISSHOW = #{fieldIsShow}
|
WHERE
|
FORMID = #{formID} AND
|
TENANTID = #{tenantID} AND
|
FIELDKEY = #{fieldKey}
|
</update>
|
|
<update id = "updateMainFormFieldService" parameterType="cn.autoform.db.entity.FormFieldEntity">
|
UPDATE
|
FORMFIELD
|
SET
|
SEARCHISSHOW = #{searchIsShow}
|
WHERE
|
FORMID = #{formID} AND
|
TENANTID = #{tenantID} AND
|
FIELDKEY = #{fieldKey}
|
</update>
|
|
<select id="queryMaxOrderNum" resultType="java.lang.Integer">
|
SELECT
|
MAX(columnOrderNum) AS MAXNUM
|
FROM
|
FORMFIELD
|
WHERE
|
FORMID = #{formID} AND
|
TENANTID = #{tenantID} AND
|
DELETEFLG = '0'
|
ORDER BY FIELDORDERNUM
|
</select>
|
|
<select id="queryFormdataMangers" resultType="cn.autoform.db.entity.FormDataMangerEntity">
|
SELECT
|
FORMID,
|
TENANTID,
|
FORMDATANUM,
|
FORMDATATABLE,
|
DATAROWNUM
|
FROM
|
FORMDATAMANAGER
|
WHERE
|
FORMID = #{formID} AND
|
TENANTID = #{tenantID} AND
|
DELETEFLG = '0'
|
ORDER BY FORMDATANUM
|
</select>
|
|
<select id="queryFormdataMangers1" resultType="cn.autoform.db.entity.FormDataMangerEntity">
|
SELECT
|
FORMID,
|
TENANTID,
|
FORMDATANUM,
|
FORMDATATABLE,
|
DATAROWNUM
|
FROM
|
FORMDATAMANAGER
|
WHERE
|
FORMID = #{formID} AND
|
TENANTID = #{tenantID} AND
|
FORMDATANUM = #{formdataNum} AND
|
DELETEFLG = '0'
|
ORDER BY FORMDATANUM
|
</select>
|
|
|
<select id="queryFormdatas" resultType="java.util.HashMap">
|
${executesql}
|
</select>
|
|
<select id="queryFormdataCount" resultType="java.lang.Integer">
|
${executesql}
|
</select>
|
|
<select id="queryFormFields2" resultType="cn.autoform.db.entity.FormFieldEntity">
|
SELECT
|
FORMFIELD.FORMID,
|
FORMFIELD.TENANTID,
|
FORMFIELD.COLUMNORDERNUM,
|
FORMFIELD.FIELDTYPE,
|
FORMFIELD.PARENTSUBFORMNUM,
|
FORMFIELD.FIELDORDERNUM,
|
FORMFIELD.FIELDKEY
|
FROM
|
FORMFIELD
|
WHERE
|
FORMFIELD.FORMID = #{formID} AND
|
FORMFIELD.TENANTID = #{tenantID} AND
|
FORMFIELD.DELETEFLG = '0'
|
ORDER BY FORMFIELD.FIELDORDERNUM
|
</select>
|
|
<select id="queryFormFields3" resultType="cn.autoform.db.entity.FormFieldEntity">
|
SELECT
|
FORMFIELD.FORMID,
|
FORMFIELD.TENANTID,
|
FORMFIELD.COLUMNORDERNUM,
|
FORMFIELD.FIELDTYPE,
|
FORMFIELD.PARENTSUBFORMNUM,
|
FORMFIELD.FIELDORDERNUM,
|
FORMFIELD.FIELDKEY
|
FROM
|
FORMFIELD
|
WHERE
|
FORMFIELD.FORMID = #{formID} AND
|
FORMFIELD.TENANTID = #{tenantID} AND
|
FORMFIELD.DELETEFLG = '0'
|
ORDER BY FORMFIELD.FIELDORDERNUM
|
</select>
|
|
<select id="queryFormdataManagers2" resultType="cn.autoform.db.entity.FormDataMangerEntity">
|
SELECT
|
FORMID,
|
TENANTID,
|
FORMDATANUM,
|
FORMDATATABLE,
|
SUBFORMFLG,
|
SUBFORMFIELDKEY,
|
DATAROWNUM
|
FROM
|
FORMDATAMANAGER
|
WHERE
|
FORMID = #{formID} AND
|
TENANTID = #{tenantID} AND
|
DELETEFLG = '0'
|
</select>
|
|
<select id="queryFormdataManagersFor" resultType="cn.autoform.db.entity.FormDataMangerEntity">
|
SELECT
|
FORMID,
|
TENANTID,
|
FORMDATANUM,
|
FORMDATATABLE,
|
SUBFORMFLG,
|
SUBFORMFIELDKEY,
|
DATAROWNUM
|
FROM
|
FORMDATAMANAGER
|
WHERE
|
FORMID = #{formID} AND
|
TENANTID = #{tenantID} AND
|
FORMDATANUM = 0 AND
|
DELETEFLG = '0'
|
FOR UPDATE
|
</select>
|
|
<update id = "updateFormdataManagersFor" parameterType="cn.autoform.db.entity.FormdataManagerEntity">
|
UPDATE
|
FORMDATAMANAGER
|
SET
|
DATAROWNUM = #{datarowNum}
|
WHERE
|
FORMID = #{formID} AND
|
TENANTID = #{tenantID} AND
|
FORMDATANUM = 0 AND
|
DELETEFLG = '0'
|
</update>
|
|
<insert id="excuteFormDataInsert">
|
${excuteSql}
|
</insert>
|
|
<update id="removeFormData">
|
${excuteSql}
|
</update>
|
|
<update id="updateFormData">
|
${excuteSql}
|
</update>
|
|
<select id="queryFormdataManagers3" resultType="cn.autoform.db.entity.FormDataMangerEntity">
|
SELECT
|
FORMID,
|
TENANTID,
|
FORMDATANUM,
|
FORMDATATABLE,
|
SUBFORMFLG,
|
SUBFORMFIELDKEY,
|
DATAROWNUM
|
FROM
|
FORMDATAMANAGER
|
WHERE
|
FORMID = #{formID} AND
|
TENANTID = #{tenantID} AND
|
FORMDATANUM = #{formdataNum} AND
|
DELETEFLG = '0'
|
</select>
|
|
<update id="addFormStateData" parameterType="String">
|
/*!mycat:sql=select tenantid from FORMDATAMANAGER WHERE TENANTID = '%s' AND FROMID = '%s' */
|
UPDATE
|
FORMDATA_${formState.tenantID}_${formState.formID}
|
SET
|
FORMSTATE = #{formState.formStateData}
|
WHERE
|
TENANTID = #{formState.tenantID}
|
</update>
|
|
<select id="queryFormFiled" resultType = "java.util.Map">
|
SELECT
|
formfield.PARENTSUBFORMNUM,
|
formfield.FIELDKEY,
|
formfield.FIELDTYPE,
|
fieldproperty.`VALUE` title
|
FROM
|
formfield
|
LEFT JOIN
|
fieldproperty
|
ON formfield.FORMID = fieldproperty.FORMID
|
AND formfield.TENANTID = fieldproperty.TENANTID
|
AND formfield.COLUMNORDERNUM = fieldproperty.COLUMNORDERNUM
|
AND fieldproperty.PROPERTY = 'title'
|
AND fieldproperty.DELETEFLG = '0'
|
WHERE
|
formfield.FORMID = '${formID}'
|
AND formfield.TENANTID = '${tenantID}'
|
AND formfield.DELETEFLG = '0'
|
AND formfield.FIELDTYPE != 'subform'
|
AND formfield.FIELDKEY != 'DATAROWNUM'
|
AND formfield.FIELDTYPE != 'mytext'
|
</select>
|
|
<select id="queryFormFields4" resultType="cn.autoform.db.entity.FormFieldEntity">
|
select
|
formfield.formid as formid,
|
formfield.tenantid as tenantid,
|
formfield.columnordernum as columnordernum,
|
case when fieldproperty.value = 'password' then 'password' else formfield.fieldtype end as fieldtype,
|
formfield.parentsubformnum as parentsubformnum,
|
formfield.fieldordernum as fieldordernum,
|
formfield.fieldkey as fieldkey,
|
fieldproperty.value as value,
|
formbase.fieldset
|
from
|
formfield
|
left join fieldproperty
|
on
|
formfield.formid = fieldproperty.formid
|
and formfield.tenantid = fieldproperty.tenantid
|
and formfield.columnordernum = fieldproperty.columnordernum
|
and (fieldproperty.property = 'datatype' or fieldproperty.property = 'format' or fieldproperty.property = 'chooseForm')
|
and fieldproperty.deleteflg = '0'
|
left join formbase
|
on
|
formfield.formid = formbase.formid
|
and formfield.tenantid = formbase.tenantid
|
where
|
formfield.formid = #{formID} and
|
formfield.tenantid = #{tenantID} and
|
formfield.deleteflg = '0'
|
limit 1
|
</select>
|
</mapper>
|