235 lines
8.6 KiB
XML
235 lines
8.6 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="cn.com.tenlion.dao.cardtemplateuse.ICardTemplateUseDao">
|
|
|
|
<resultMap id="cardTemplateUseDTO" type="cn.com.tenlion.pojo.dtos.cardtemplateuse.CardTemplateUseDTO">
|
|
<id column="card_template_use_id" property="cardTemplateUseId"/>
|
|
<result column="template_id" property="templateId"/>
|
|
<result column="template_title" property="templateTitle"/>
|
|
<result column="template_use_title" property="templateUseTitle"/>
|
|
<result column="template_use_barcode" property="templateUseBarcode"/>
|
|
<result column="template_use_barcode_style" property="templateUseBarcodeStyle"/>
|
|
<result column="template_use_barcode_style_dictionary_name" property="templateUseBarcodeStyleDictionaryName"/>
|
|
<result column="template_use_scans_number" property="templateUseScansNumber"/>
|
|
<result column="template_use_switch" property="templateUseSwitch"/>
|
|
<result column="template_use_open" property="templateUseOpen"/>
|
|
<result column="template_use_capture" property="templateUseCapture"/>
|
|
<result column="template_use_password" property="templateUsePassword"/>
|
|
<result column="template_use_city" property="templateUseCity"/>
|
|
<result column="template_use_city_dictionary_name" property="templateUseCityDictionaryName"/>
|
|
<result column="template_use_url" property="templateUseUrl"/>
|
|
</resultMap>
|
|
|
|
<!-- 新增模板使用 -->
|
|
<insert id="saveCardTemplateUse" parameterType="map">
|
|
INSERT INTO card_template_use(
|
|
card_template_use_id,
|
|
template_id,
|
|
template_title,
|
|
template_use_title,
|
|
template_use_barcode,
|
|
template_use_barcode_style,
|
|
template_use_scans_number,
|
|
template_use_switch,
|
|
template_use_open,
|
|
template_use_capture,
|
|
template_use_password,
|
|
template_use_city,
|
|
template_use_url,
|
|
creator,
|
|
gmt_create,
|
|
modifier,
|
|
gmt_modified,
|
|
is_delete
|
|
) VALUES(
|
|
#{cardTemplateUseId},
|
|
#{templateId},
|
|
#{templateTitle},
|
|
#{templateUseTitle},
|
|
#{templateUseBarcode},
|
|
#{templateUseBarcodeStyle},
|
|
#{templateUseScansNumber},
|
|
#{templateUseSwitch},
|
|
#{templateUseOpen},
|
|
#{templateUseCapture},
|
|
#{templateUsePassword},
|
|
#{templateUseCity},
|
|
#{templateUseUrl},
|
|
#{creator},
|
|
#{gmtCreate},
|
|
#{modifier},
|
|
#{gmtModified},
|
|
#{isDelete}
|
|
)
|
|
</insert>
|
|
|
|
<!-- 删除模板使用 -->
|
|
<update id="removeCardTemplateUse" parameterType="map">
|
|
UPDATE
|
|
card_template_use
|
|
SET
|
|
is_delete = 1,
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
card_template_use_id IN
|
|
<foreach collection="cardTemplateUseIds" index="index" open="(" separator="," close=")">
|
|
#{cardTemplateUseIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 删除模板使用(物理) -->
|
|
<update id="deleteCardTemplateUse" parameterType="map">
|
|
DELETE FROM
|
|
card_template_use
|
|
WHERE
|
|
card_template_use_id IN
|
|
<foreach collection="cardTemplateUseIds" index="index" open="(" separator="," close=")">
|
|
#{cardTemplateUseIds[${index}]}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 修改模板使用 -->
|
|
<update id="updateCardTemplateUse" parameterType="map">
|
|
UPDATE
|
|
card_template_use
|
|
SET
|
|
<if test="templateId != null and templateId != ''">
|
|
template_id = #{templateId},
|
|
</if>
|
|
<if test="templateTitle != null and templateTitle != ''">
|
|
template_title = #{templateTitle},
|
|
</if>
|
|
<if test="templateUseTitle != null and templateUseTitle != ''">
|
|
template_use_title = #{templateUseTitle},
|
|
</if>
|
|
<if test="templateUseBarcode != null and templateUseBarcode != ''">
|
|
template_use_barcode = #{templateUseBarcode},
|
|
</if>
|
|
<if test="templateUseBarcodeStyle != null and templateUseBarcodeStyle != ''">
|
|
template_use_barcode_style = #{templateUseBarcodeStyle},
|
|
</if>
|
|
<if test="templateUseScansNumber != null">
|
|
template_use_scans_number = #{templateUseScansNumber},
|
|
</if>
|
|
<if test="templateUseSwitch != null">
|
|
template_use_switch = #{templateUseSwitch},
|
|
</if>
|
|
<if test="templateUseOpen != null">
|
|
template_use_open = #{templateUseOpen},
|
|
</if>
|
|
<if test="templateUseCapture != null">
|
|
template_use_capture = #{templateUseCapture},
|
|
</if>
|
|
<if test="templateUsePassword != null and templateUsePassword != ''">
|
|
template_use_password = #{templateUsePassword},
|
|
</if>
|
|
<if test="templateUseCity != null and templateUseCity != ''">
|
|
template_use_city = #{templateUseCity},
|
|
</if>
|
|
<if test="templateUseUrl != null and templateUseUrl != ''">
|
|
template_use_url = #{templateUseUrl},
|
|
</if>
|
|
modifier = #{modifier},
|
|
gmt_modified = #{gmtModified}
|
|
WHERE
|
|
card_template_use_id = #{cardTemplateUseId}
|
|
</update>
|
|
|
|
<!-- 模板使用详情 -->
|
|
<select id="getCardTemplateUse" parameterType="map" resultMap="cardTemplateUseDTO">
|
|
SELECT
|
|
t1.template_id,
|
|
t1.template_title,
|
|
t1.template_use_title,
|
|
t1.template_use_barcode,
|
|
t1.template_use_barcode_style,
|
|
t1.template_use_scans_number,
|
|
t1.template_use_switch,
|
|
t1.template_use_open,
|
|
t1.template_use_capture,
|
|
t1.template_use_password,
|
|
t1.template_use_city,
|
|
t1.template_use_url,
|
|
t1.card_template_use_id
|
|
FROM
|
|
card_template_use t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
<if test="cardTemplateUseId != null and cardTemplateUseId != ''">
|
|
AND
|
|
t1.card_template_use_id = #{cardTemplateUseId}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 模板使用列表 -->
|
|
<select id="listCardTemplateUse" parameterType="map" resultMap="cardTemplateUseDTO">
|
|
SELECT
|
|
t1.template_id,
|
|
t1.template_title,
|
|
t1.template_use_title,
|
|
t1.template_use_barcode,
|
|
t1.template_use_barcode_style,
|
|
dt1.dictionary_name template_use_barcode_style_dictionary_name,
|
|
t1.template_use_scans_number,
|
|
t1.template_use_switch,
|
|
t1.template_use_open,
|
|
t1.template_use_capture,
|
|
t1.template_use_password,
|
|
t1.template_use_city,
|
|
dt2.dictionary_name template_use_city_dictionary_name,
|
|
t1.template_use_url,
|
|
t1.card_template_use_id
|
|
FROM
|
|
card_template_use t1
|
|
LEFT JOIN
|
|
data_dictionary dt1
|
|
ON
|
|
dt1.dictionary_id = t1.template_use_barcode_style
|
|
AND
|
|
dt1.is_delete = 0
|
|
LEFT JOIN
|
|
data_dictionary dt2
|
|
ON
|
|
dt2.dictionary_id = t1.template_use_city
|
|
AND
|
|
dt2.is_delete = 0
|
|
WHERE
|
|
t1.is_delete = 0 AND t1.creator = #{creator}
|
|
<if test="keywords != null and keywords != ''">
|
|
AND (
|
|
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
|
OR
|
|
t1.card_template_use_id LIKE CONCAT('%', #{keywords}, '%')
|
|
<!-- 这里添加其他条件 -->
|
|
)
|
|
</if>
|
|
<if test="startTime != null and startTime != ''">
|
|
AND
|
|
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
|
</if>
|
|
<if test="endTime != null and endTime != ''">
|
|
AND
|
|
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
|
</if>
|
|
<if test="cardTemplateUseIds != null and cardTemplateUseIds.size > 0">
|
|
AND
|
|
t1.card_template_use_id IN
|
|
<foreach collection="cardTemplateUseIds" index="index" open="(" separator="," close=")">
|
|
#{cardTemplateUseIds[${index}]}
|
|
</foreach>
|
|
</if>
|
|
ORDER BY t1.gmt_create
|
|
</select>
|
|
|
|
<!-- 模板使用统计 -->
|
|
<select id="countCardTemplateUse" parameterType="map" resultType="Integer">
|
|
SELECT
|
|
COUNT(*)
|
|
FROM
|
|
card_template_use t1
|
|
WHERE
|
|
t1.is_delete = 0
|
|
</select>
|
|
|
|
</mapper> |