<?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.panzhihua.service_community.dao.ConvenientServiceCategoryDAO">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ConvenientServiceCategoryDO">
|
<id column="id" property="id" />
|
<id column="name" property="name" />
|
<id column="icon" property="icon" />
|
<id column="remark" property="remark" />
|
<id column="weight" property="weight" />
|
<id column="is_del" property="isDel" />
|
<id column="created_at" property="createdAt" />
|
<id column="created_by" property="createdBy" />
|
<id column="updated_at" property="updatedAt" />
|
<id column="updated_by" property="updatedBy" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id,`name`,icon,remark,weight,is_del,created_at,created_by,updated_at,updated_by
|
</sql>
|
<insert id="createMerchantServiceRelation">
|
INSERT INTO com_convenient_service_scope (id,merchant_id, service_category_id, service_name, created_by, created_at)
|
VALUES (#{id},#{merchantId}, #{serviceId}, #{name}, #{createdBy}, NOW())
|
</insert>
|
<delete id="deleteMerchantServiceRelation">
|
DELETE FROM com_convenient_service_scope WHERE merchant_id = #{merchantId}
|
</delete>
|
<select id="pageServiceCategory" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientServiceCategoryVO">
|
SELECT <include refid="Base_Column_List"/>
|
FROM com_convenient_service_categories
|
WHERE is_del = 0
|
<if test="pageConvenientServiceCategoryDTO.name != null and pageConvenientServiceCategoryDTO.name.trim() != """>
|
AND `name` LIKE concat('%', #{pageConvenientServiceCategoryDTO.name}, '%' )
|
</if>
|
<if test="pageConvenientServiceCategoryDTO.areaCode != null and pageConvenientServiceCategoryDTO.areaCode.trim() != """>
|
AND area_code = #{pageConvenientServiceCategoryDTO.areaCode}
|
</if>
|
ORDER BY weight DESC
|
</select>
|
<select id="selectServiceScopeByMerchantId" resultType="java.lang.String">
|
SELECT GROUP_CONCAT(`service_name`) serviceScope FROM com_convenient_service_scope WHERE merchant_id = #{merchantId}
|
</select>
|
<select id="selectServiceIdsForMerchant" resultType="java.lang.String">
|
SELECT service_category_id FROM com_convenient_service_scope WHERE merchant_id = #{merchantId}
|
</select>
|
<select id="checkCategoryIsUsing" resultType="java.lang.Integer">
|
SELECT COUNT(1) FROM com_convenient_service_scope WHERE service_category_id = #{categoryId}
|
</select>
|
<select id="selectSuitableServiceCategories" resultType="com.panzhihua.common.model.vos.community.convenient.ConvenientServiceCategoryVO">
|
SELECT ccsc.id, ccsc.name, ccsc.icon, ccsc.remark, ccsc.weight
|
FROM com_convenient_service_categories ccsc
|
INNER JOIN com_convenient_service_scope ccss ON ccsc.id = ccss.service_category_id
|
INNER JOIN com_convenient_merchants ccm ON ccss.merchant_id = ccm.id
|
WHERE ccsc.is_del = 0 AND ccm.is_del = 0 AND( ccm.community_id = ${communityId} or ccm.community_id =0) and ccsc.area_code = #{areaCode} AND ccm.business_status = 1 GROUP BY ccsc.id ORDER BY ccsc.weight desc
|
</select>
|
</mapper>
|