<?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.formset.FormSetMapper" >
|
|
<resultMap id="FormSetListInfoMap" type="cn.autoform.db.entity.FormSetInfoEntity">
|
<id property="formSetID" column="FORMSETID" />
|
<result property="formName" column="FORMNAME"/>
|
<result property="usedversion" column="USEDVERSION"/>
|
<result property="createUser" column="CREATEUSER"/>
|
<result property="createDatetime" column="CREATEDATETIME"/>
|
<result property="bussinesssystem" column="BUSSINESSSYSTEM"/>
|
<collection property="formbaseInfos" ofType="cn.autoform.db.entity.FormBaseInfoEntity">
|
<id property="formID" column="FORMID" />
|
<result property="formVer" column="FORMVERSION" />
|
<result property="formSetID" column="FORMSETID" />
|
</collection>
|
</resultMap>
|
|
<select id ="getFlagByFormID" resultType="java.lang.String">
|
SELECT
|
formset.BUSSINESSSYSTEM
|
FROM
|
formset
|
LEFT JOIN formversion ON formset.FORMSETID = formversion.FORMSETID AND formset.TENANTID = formversion.TENANTID
|
WHERE
|
formversion.FORMID = #{formID}
|
AND
|
formversion.TENANTID = #{tenantID}
|
|
</select>
|
|
<select id="getFormSetInfo" resultType="cn.autoform.db.entity.FormSetEntity">
|
SELECT
|
FORMSETID,
|
TENANTID,
|
FORMNAME,
|
DESCRIPTION,
|
USEDVERSION,
|
DELETEFLG,
|
CREATEUSER,
|
CREATEDATETIME,
|
UPDATEUSER
|
FROM
|
FORMSET
|
WHERE
|
|
FORMSETID = #{formSetID}
|
AND
|
TENANTID = #{tenantID}
|
AND
|
DELETEFLG = "0"
|
</select>
|
|
<select id="getFormSetListInfo" resultMap="FormSetListInfoMap">
|
SELECT
|
FSET.FORMSETID,
|
FSET.FORMNAME,
|
FSET.USEDVERSION,
|
FSET.CREATEUSER,
|
FSET.CREATEDATETIME,
|
FSET.BUSSINESSSYSTEM,
|
FVERSION.FORMID,
|
FVERSION.FORMVERSION
|
FROM
|
FORMSET FSET
|
LEFT JOIN FORMVERSION FVERSION ON FSET.FORMSETID = FVERSION.FORMSETID
|
WHERE
|
FSET.TENANTID =#{tenantID}
|
AND
|
FSET.DELETEFLG = "0"
|
<if test="selectName != null">
|
AND
|
FSET.FORMNAME LIKE CONCAT('%',#{selectName},'%')
|
</if>
|
ORDER BY FSET.FORMNAME ASC,
|
FSET.CREATEDATETIME DESC
|
<if test="pageSize != 0 ">
|
LIMIT #{pageStrat},#{pageSize}
|
</if>
|
</select>
|
<select id="getFormSetListCount" resultType="int">
|
SELECT
|
count(*)
|
FROM
|
FORMSET FSET
|
LEFT JOIN FORMVERSION FVERSION ON FSET.FORMSETID = FVERSION.FORMSETID
|
WHERE
|
FSET.TENANTID =#{tenantID}
|
AND
|
FSET.DELETEFLG = "0"
|
<if test="selectName != null">
|
AND
|
FSET.FORMNAME LIKE CONCAT(#{selectName},'%')
|
</if>
|
</select>
|
<!-- AND A.BUSSINESSSYSTEM = #{businessSystem} 后续修改添加flag使用 -->
|
<select id="queryFormSetPaging" parameterType="cn.autoform.db.exten.FormSetPage" resultType="cn.autoform.db.entity.FormOperationEntity">
|
SELECT
|
formSet.FORMSETID,
|
formBase.FORMID,
|
formSet.TENANTID,
|
formSet.FORMNAME,
|
formSet.BUSSINESSSYSTEM,
|
ENABLESETTING
|
FROM
|
FORMSET formSet
|
INNER JOIN FORMVERSION formVersion
|
ON
|
formSet.FORMSETID = formVersion.FORMSETID
|
AND formSet.TENANTID = formVersion.TENANTID
|
INNER JOIN FORMBASE formBase
|
ON
|
formVersion.FORMID = formBase.FORMID
|
AND formVersion.TENANTID = formBase.TENANTID
|
WHERE
|
formSet.TENANTID = #{tenantID}
|
|
AND formSet.DELETEFLG = '0'
|
AND formBase.DELETEFLG = '0'
|
<if test="formName != null">
|
AND
|
formSet.FORMNAME LIKE concat('%', #{formName}, '%')
|
</if>
|
ORDER BY formSet.FORMNAME ASC,
|
formSet.CREATEDATETIME DESC
|
</select>
|
|
<select id="queryFormSetBussinesssystem" parameterType="cn.autoform.db.entity.FormSetEntity" resultType="java.lang.String">
|
SELECT
|
BUSSINESSSYSTEM
|
FROM
|
FORMSET
|
WHERE
|
FORMSETID = #{formSetID}
|
AND TENANTID = #{tenantID}
|
</select>
|
|
<select id="getFormVersionByFormsetId" resultType="cn.autoform.db.entity.FormBaseInfoEntity">
|
SELECT
|
FVERSION.FORMID,
|
FVERSION.FORMVERSION AS formVer,
|
FORMSETID
|
FROM
|
FORMVERSION FVERSION
|
WHERE
|
FVERSION.FORMSETID = #{formSetID}
|
</select>
|
|
<select id="queryFormSetCount" resultType="java.lang.Integer">
|
SELECT
|
COUNT(1)
|
FROM
|
FORMSET formSet
|
INNER JOIN FORMVERSION formVersion
|
ON
|
formSet.FORMSETID = formVersion.FORMSETID
|
AND formSet.TENANTID = formVersion.TENANTID
|
INNER JOIN FORMBASE formBase
|
ON
|
formVersion.FORMID = formBase.FORMID
|
AND formVersion.TENANTID = formBase.TENANTID
|
WHERE
|
formSet.TENANTID = 001 #{tenantID}
|
AND formBase.ENABLESETTING = '1'
|
AND formSet.DELETEFLG = '0'
|
AND formBase.DELETEFLG = '0'
|
<if test="formName != null">
|
WHERE
|
formSet.FORMNAME LIKE #{formName}
|
</if>
|
</select>
|
|
<update id="updateFormSetInfo" parameterType="cn.autoform.db.entity.FormSetEntity">
|
UPDATE FORMSET
|
SET
|
FORMNAME = #{formName},
|
DESCRIPTION = #{description},
|
USEDVERSION = #{usedversion}
|
WHERE
|
FORMSETID = #{formSetID}
|
AND TENANTID = #{tenantID}
|
</update>
|
|
<update id="updateFormSetUseVerInfo" parameterType="cn.autoform.db.entity.FormSetEntity">
|
UPDATE FORMSET
|
SET
|
USEDVERSION = #{usedversion},
|
UPDATEUSER = #{updateUser}
|
WHERE
|
FORMSETID = #{formSetID}
|
AND TENANTID = #{tenantID}
|
</update>
|
|
<insert id="insert" parameterType="cn.autoform.db.entity.FormSetEntity">
|
INSERT INTO FORMSET
|
(FORMSETID,
|
TENANTID,
|
FORMNAME,
|
DESCRIPTION,
|
USEDVERSION,
|
DELETEFLG,
|
CREATEUSER,
|
CREATEDATETIME,
|
UPDATEUSER,
|
UPDATEDATETIME,
|
BUSSINESSSYSTEM)
|
VALUES
|
(#{formSetID},
|
#{tenantID},
|
#{formName},
|
#{description},
|
#{usedversion},
|
'0',
|
#{createUser},
|
CURRENT_TIMESTAMP(),
|
#{updateUser},
|
CURRENT_TIMESTAMP(),
|
#{businessSystem})
|
</insert>
|
|
<select id="getFormOperationInfo" resultType="cn.autoform.db.entity.FormOperationEntity">
|
SELECT
|
formSet.FORMSETID,
|
formBase.FORMID,
|
formSet.TENANTID,
|
formSet.FORMNAME,
|
formSet.BUSSINESSSYSTEM
|
FROM
|
FORMSET formSet
|
INNER JOIN FORMVERSION formVersion
|
ON
|
formSet.FORMSETID = formVersion.FORMSETID
|
AND formSet.TENANTID = formVersion.TENANTID
|
INNER JOIN FORMBASE formBase
|
ON
|
formVersion.FORMID = formBase.FORMID
|
AND formVersion.TENANTID = formBase.TENANTID
|
WHERE
|
formSet.TENANTID = #{tenantID}
|
AND formBase.ENABLESETTING = '1'
|
AND formSet.DELETEFLG = '0'
|
AND formBase.DELETEFLG = '0'
|
ORDER BY formSet.FORMNAME ASC,
|
formSet.CREATEDATETIME DESC
|
</select>
|
|
<update id="updateFormSetInfo1" parameterType="cn.autoform.db.entity.FormSetEntity">
|
UPDATE FORMSET
|
SET
|
FORMNAME = #{formName},
|
UPDATEUSER = #{updateUser}
|
WHERE
|
FORMSETID = #{formSetID}
|
AND TENANTID = #{tenantID}
|
</update>
|
|
<update id="deleteFormSet" parameterType="cn.autoform.db.entity.FormSetEntity">
|
UPDATE FORMSET
|
SET
|
DELETEFLG = "1",
|
UPDATEUSER = #{updateUser}
|
WHERE
|
FORMSETID = #{formSetID}
|
AND TENANTID = #{tenantID}
|
</update>
|
|
<select id="selectBuss" resultType="java.lang.String">
|
SELECT
|
FORMNAME
|
FROM
|
formset
|
WHERE
|
FORMSETID = (
|
SELECT
|
FORMSETID
|
FROM
|
formversion
|
WHERE
|
FORMID = #{formId} and TENANTID = #{tenantId}
|
)
|
limit 1
|
</select>
|
</mapper>
|