business-card/src/main/resources/mybatis/mapper/shop/shop-mapper.xml
2021-03-24 17:31:41 +08:00

408 lines
13 KiB
XML
Raw Blame History

<?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.shop.IShopDao">
<resultMap id="shopDTO" type="cn.com.tenlion.pojo.dtos.shop.ShopDTO">
<result column="shop_id" property="shopId"/>
<result column="shop_name" property="shopName"/>
<result column="shop_summary" property="shopSummary"/>
<result column="shop_address" property="shopAddress"/>
<result column="shop_star" property="shopStar"/>
<result column="shop_logo" property="shopLogo"/>
<result column="shop_template_id" property="shopTemplateId"/>
<result column="user_evaluate" property="userEvaluate"/>
<result column="is_open" property="isOpen"/>
<result column="open_date" property="openDate"/>
<result column="is_log_off" property="isLogOff"/>
<result column="is_certification" property="isCertification"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
</resultMap>
<resultMap id="shopBO" type="cn.com.tenlion.pojo.bos.shop.ShopBO">
<result column="shop_id" property="shopId"/>
<result column="shop_name" property="shopName"/>
<result column="shop_summary" property="shopSummary"/>
<result column="shop_star" property="shopStar"/>
<result column="shop_logo" property="shopLogo"/>
<result column="shop_template_id" property="shopTemplateId"/>
<result column="user_evaluate" property="userEvaluate"/>
<result column="is_open" property="isOpen"/>
<result column="open_date" property="openDate"/>
<result column="is_log_off" property="isLogOff"/>
<result column="is_certification" property="isCertification"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="shopPO" type="cn.com.tenlion.pojo.pos.shop.ShopPO">
<result column="shop_id" property="shopId"/>
<result column="shop_name" property="shopName"/>
<result column="shop_summary" property="shopSummary"/>
<result column="shop_star" property="shopStar"/>
<result column="shop_logo" property="shopLogo"/>
<result column="shop_template_id" property="shopTemplateId"/>
<result column="user_evaluate" property="userEvaluate"/>
<result column="is_open" property="isOpen"/>
<result column="open_date" property="openDate"/>
<result column="is_log_off" property="isLogOff"/>
<result column="is_certification" property="isCertification"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="creator" property="creator"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="modifier" property="modifier"/>
<result column="is_delete" property="isDelete"/>
</resultMap>
<!-- 保存 -->
<insert id="save" parameterType="map">
INSERT INTO svc_shop(
shop_id,
shop_name,
shop_summary,
shop_address,
shop_star,
shop_logo,
shop_template_id,
user_evaluate,
is_open,
open_date,
is_log_off,
is_certification,
gmt_create,
creator,
gmt_modified,
modifier,
is_delete
) VALUES(
#{shopId},
#{shopName},
#{shopSummary},
#{shopAddress},
#{shopStar},
#{shopLogo},
#{shopTemplateId},
#{userEvaluate},
#{isOpen},
#{openDate},
#{isLogOff},
#{isCertification},
#{gmtCreate},
#{creator},
#{gmtModified},
#{modifier},
#{isDelete}
)
</insert>
<!-- 逻辑删除-->
<update id="remove" parameterType="map">
UPDATE
svc_shop
SET
gmt_modified = #{gmtModified},
modifier = #{modifier},
is_delete = 1
WHERE
shop_id IN
<foreach collection="shopIds" index="index" open="(" separator="," close=")">
#{shopIds[${index}]}
</foreach>
</update>
<!-- 物理删除 -->
<update id="delete" parameterType="map">
DELETE FROM
svc_shop
WHERE
shop_id IN
<foreach collection="shopIds" index="index" open="(" separator="," close=")">
#{shopIds[${index}]}
</foreach>
</update>
<!-- 修改 -->
<update id="update" parameterType="map">
UPDATE
svc_shop
SET
<if test="shopId != null and shopId != ''">
shop_id = #{shopId},
</if>
<if test="shopName != null and shopName != ''">
shop_name = #{shopName},
</if>
<if test="shopSummary != null and shopSummary != ''">
shop_summary = #{shopSummary},
</if>
<if test="shopAddress != null and shopAddress != ''">
shop_address = #{shopAddress},
</if>
<if test="shopStar != null">
shop_star = #{shopStar},
</if>
<if test="shopLogo != null and shopLogo != ''">
shop_logo = #{shopLogo},
</if>
<if test="shopTemplateId != null and shopTemplateId != ''">
shop_template_id = #{shopTemplateId},
</if>
<if test="userEvaluate != null">
user_evaluate = #{userEvaluate},
</if>
<if test="isOpen != null">
is_open = #{isOpen},
</if>
<if test="openDate != null and openDate != ''">
open_date = #{openDate},
</if>
<if test="isLogOff != null">
is_log_off = #{isLogOff},
</if>
<if test="gmtModified != null and gmtModified != ''">
gmt_modified = #{gmtModified},
</if>
<if test="modifier != null and modifier != ''">
modifier = #{modifier},
</if>
<if test="isDelete != null">
is_delete = #{isDelete}
</if>
WHERE
shop_id = #{shopId}
</update>
<!-- 获取详情-->
<select id="get" parameterType="map" resultMap="shopDTO">
SELECT
t1.shop_id,
t1.shop_name,
t1.shop_summary,
t1.shop_address,
t1.shop_star,
t1.shop_logo,
t1.shop_template_id,
t1.user_evaluate,
t1.is_open,
t1.open_date,
t1.is_log_off,
t1.is_certification,
t1.shop_id
FROM
svc_shop t1
WHERE
t1.is_delete = 0
<if test="shopId != null and shopId != ''">
AND
t1.shop_id = #{shopId}
</if>
</select>
<!-- 获取详情 -->
<select id="getBO" parameterType="map" resultMap="shopBO">
SELECT
t1.shop_id,
t1.shop_name,
t1.shop_summary,
t1.shop_star,
t1.shop_logo,
t1.shop_template_id,
t1.user_evaluate,
t1.audit_result,
t1.is_open,
t1.open_date,
t1.is_log_off,
t1.is_certification,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.is_delete
FROM
svc_shop t1
WHERE
t1.is_delete = 0
<if test="shopId != null and shopId != ''">
AND
t1.shop_id = #{shopId}
</if>
</select>
<!-- 获取详情 -->
<select id="getPO" parameterType="map" resultMap="shopPO">
SELECT
t1.shop_id,
t1.shop_name,
t1.shop_summary,
t1.shop_star,
t1.shop_logo,
t1.shop_template_id,
t1.user_evaluate,
t1.is_open,
t1.open_date,
t1.is_log_off,
t1.is_certification,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.is_delete
FROM
svc_shop t1
WHERE
t1.is_delete = 0
<if test="shopId != null and shopId != ''">
AND
t1.shop_id = #{shopId}
</if>
</select>
<!-- 列表-->
<select id="list" parameterType="map" resultMap="shopDTO">
SELECT
t1.shop_id,
t1.shop_name,
t1.shop_summary,
t1.shop_star,
t1.shop_logo,
t1.shop_template_id,
t1.user_evaluate,
t1.is_open,
t1.open_date,
t1.is_log_off,
t1.is_certification,
t1.gmt_create,
t1.creator
FROM
svc_shop t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
t1.shop_name 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="creator != null and creator != ''">
AND
t1.creator = #{creator}
</if>
ORDER BY t1.gmt_create DESC
</select>
<!-- 列表-->
<select id="listBO" parameterType="map" resultMap="shopBO">
SELECT
t1.shop_id,
t1.shop_name,
t1.shop_summary,
t1.shop_star,
t1.shop_logo,
t1.shop_template_id,
t1.user_evaluate,
t1.is_open,
t1.open_date,
t1.is_log_off,
t1.is_certification,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.is_delete
FROM
svc_shop t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -->
t1.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="shopIds != null and shopIds.size > 0">
AND
t1.shop_id IN
<foreach collection="shopIds" index="index" open="(" separator="," close=")">
#{shopIds[${index}]}
</foreach>
</if>
</select>
<!-- 列表-->
<select id="listPO" parameterType="map" resultMap="shopPO">
SELECT
t1.shop_id,
t1.shop_name,
t1.shop_summary,
t1.shop_star,
t1.shop_logo,
t1.shop_template_id,
t1.user_evaluate,
t1.is_open,
t1.open_date,
t1.is_log_off,
t1.is_certification,
t1.gmt_create,
t1.creator,
t1.gmt_modified,
t1.modifier,
t1.is_delete
FROM
svc_shop t1
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
<!-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -->
t1.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="shopIds != null and shopIds.size > 0">
AND
t1.shop_id IN
<foreach collection="shopIds" index="index" open="(" separator="," close=")">
#{shopIds[${index}]}
</foreach>
</if>
</select>
<!-- 统计 -->
<select id="count" parameterType="map" resultType="Integer">
SELECT
COUNT(*)
FROM
svc_shop t1
WHERE
t1.is_delete = 0
</select>
</mapper>