<?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_dangjian.dao.NewFightConvenientMerchantDao">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.panzhihua.service_dangjian.entity.NewFightConvenientMerchant">
|
<id column="id" property="id" />
|
<id column="name" property="name" />
|
<id column="logo" property="logo" />
|
<id column="contacts" property="contacts" />
|
<id column="phone" property="phone" />
|
<id column="address" property="address" />
|
<id column="detailed_address" property="detailedAddress" />
|
<id column="lat" property="lat" />
|
<id column="lon" property="lon" />
|
<id column="introduction" property="introduction" />
|
<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="img_url" property="imgUrl" />
|
<id column="status" property="status" />
|
<id column="business_credit" property="businessCredit" />
|
<id column="community_id" property="communityId" />
|
<id column="user_id" property="userId" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<select id="pageMerchant" resultType="com.panzhihua.service_dangjian.entity.NewFightConvenientMerchant">
|
SELECT
|
id,
|
name,
|
logo,
|
contacts,
|
phone,
|
address,
|
detailed_address,
|
lat,
|
lon,
|
introduction,
|
is_del,
|
created_at,
|
created_by,
|
updated_at,
|
status,
|
business_credit,
|
community_id,
|
user_id,
|
img_url
|
FROM new_fight_com_convenient_merchants
|
<where>
|
1=1
|
<if test="communityId != null and communityId != '' ">
|
AND community_id=#{communityId}
|
</if>
|
<if test="isDel != null and isDel != '' ">
|
AND is_del=#{isDel}
|
</if>
|
<if test="keyword != null and keyword != """>
|
AND (
|
ccm.name LIKE CONCAT('%', #{keyword}, '%')
|
OR ccm.address LIKE CONCAT('%', #{keyword}, '%')
|
OR ccm.phone LIKE CONCAT('%', #{keyword}, '%')
|
)
|
</if>
|
<if test="status != null and status != '' ">
|
AND status=#{status}
|
</if>
|
</where>
|
GROUP BY created_at DESC
|
</select>
|
|
<select id="selectMerchantById" resultType="com.panzhihua.service_dangjian.entity.NewFightConvenientMerchant">
|
SELECT
|
id,
|
name,
|
logo,
|
contacts,
|
phone,
|
address,
|
detailed_address,
|
lat,
|
lon,
|
introduction,
|
is_del,
|
created_at,
|
created_by,
|
updated_at,
|
status,
|
business_credit,
|
community_id,
|
user_id,
|
img_url
|
FROM new_fight_com_convenient_merchants ccm
|
WHERE ccm.id = #{merchantId}
|
</select>
|
|
<update id="deleteMerchantById">
|
UPDATE new_fight_com_convenient_merchants
|
SET is_del = 1
|
WHERE id = #{merchantId}
|
</update>
|
|
|
<update id="editStatus">
|
UPDATE new_fight_com_convenient_merchants
|
SET status = #{status}
|
WHERE id = #{merchantId}
|
</update>
|
|
|
<insert id="addData">
|
insert into new_fight_com_convenient_merchants
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="item.id != null and item.id != '' ">
|
id,
|
</if>
|
<if test="item.name != null and item.name != '' ">
|
`name`,
|
</if>
|
<if test="item.logo != null and item.logo != '' ">
|
logo,
|
</if>
|
<if test="item.contacts != null and item.contacts != '' ">
|
contacts,
|
</if>
|
<if test="item.phone != null and item.phone != '' ">
|
phone,
|
</if>
|
<if test="item.address != null and item.address != '' ">
|
address,
|
</if>
|
<if test="item.detailedAddress != null and item.detailedAddress != '' ">
|
detailed_address,
|
</if>
|
<if test="item.lat != null and item.lat != '' ">
|
lat,
|
</if>
|
<if test="item.lon != null and item.lon != '' ">
|
lon,
|
</if>
|
<if test="item.introduction != null and item.introduction != '' ">
|
introduction,
|
</if>
|
<if test="item.isDel != null and item.isDel != '' ">
|
is_del,
|
</if>
|
<if test="item.createdBy != null and item.createdBy != '' ">
|
created_by,
|
</if>
|
<if test="item.imgUrl != null and item.imgUrl != '' ">
|
img_url,
|
</if>
|
<if test="item.status != null and item.status != '' ">
|
status,
|
</if>
|
<if test="item.businessCredit != null and item.businessCredit != '' ">
|
business_credit,
|
</if>
|
<if test="item.communityId != null and item.communityId != '' ">
|
community_id,
|
</if>
|
<if test="item.userId != null and item.userId != '' ">
|
user_id,
|
</if>
|
created_at
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="item.id != null and item.id != '' ">
|
#{item.id},
|
</if>
|
<if test="item.name != null and item.name != '' ">
|
#{item.name},
|
</if>
|
<if test="item.logo != null and item.logo != '' ">
|
#{item.logo},
|
</if>
|
<if test="item.contacts != null and item.contacts != '' ">
|
#{item.contacts},
|
</if>
|
<if test="item.phone != null and item.phone != '' ">
|
#{item.phone},
|
</if>
|
<if test="item.address != null and item.address != '' ">
|
#{item.address},
|
</if>
|
<if test="item.detailedAddress != null and item.detailedAddress != '' ">
|
#{item.detailedAddress},
|
</if>
|
<if test="item.lat != null and item.lat != '' ">
|
#{item.lat},
|
</if>
|
<if test="item.lon != null and item.lon != '' ">
|
#{item.lon},
|
</if>
|
<if test="item.introduction != null and item.introduction != '' ">
|
#{item.introduction},
|
</if>
|
<if test="item.isDel != null and item.isDel != '' ">
|
#{item.isDel},
|
</if>
|
<if test="item.createdBy != null and item.createdBy != '' ">
|
#{item.createdBy},
|
</if>
|
<if test="item.imgUrl != null and item.imgUrl != '' ">
|
#{item.imgUrl},
|
</if>
|
<if test="item.status != null and item.status != '' ">
|
#{item.status},
|
</if>
|
<if test="item.businessCredit != null and item.businessCredit != '' ">
|
#{item.businessCredit},
|
</if>
|
<if test="item.communityId != null and item.communityId != '' ">
|
#{item.communityId},
|
</if>
|
<if test="item.userId != null and item.userId != '' ">
|
#{item.userId},
|
</if>
|
sysdate()
|
</trim>
|
</insert>
|
|
<update id="editData">
|
update new_fight_com_convenient_merchants
|
<set>
|
<if test="item.id != null and item.id != '' ">
|
id=#{item.id},
|
</if>
|
<if test="item.name != null and item.name != '' ">
|
`name`=#{item.name},
|
</if>
|
<if test="item.logo != null and item.logo != '' ">
|
logo=#{item.logo},
|
</if>
|
<if test="item.contacts != null and item.contacts != '' ">
|
contacts=#{item.contacts},
|
</if>
|
<if test="item.phone != null and item.phone != '' ">
|
phone=#{item.phone},
|
</if>
|
<if test="item.address != null and item.address != '' ">
|
address=#{item.address},
|
</if>
|
<if test="item.detailedAddress != null and item.detailedAddress != '' ">
|
detailed_address=#{item.detailedAddress},
|
</if>
|
<if test="item.lat != null and item.lat != '' ">
|
lat=#{item.lat},
|
</if>
|
<if test="item.lon != null and item.lon != '' ">
|
lon=#{item.lon},
|
</if>
|
<if test="item.introduction != null and item.introduction != '' ">
|
introduction=#{item.introduction},
|
</if>
|
<if test="item.isDel != null and item.isDel != '' ">
|
is_del=#{item.isDel},
|
</if>
|
<if test="item.createdBy != null and item.createdBy != '' ">
|
created_by=#{item.createdBy},
|
</if>
|
<if test="item.imgUrl != null and item.imgUrl != '' ">
|
img_url=#{item.imgUrl},
|
</if>
|
<if test="item.status != null and item.status != '' ">
|
status=#{item.status},
|
</if>
|
<if test="item.businessCredit != null and item.businessCredit != '' ">
|
business_credit=#{item.businessCredit},
|
</if>
|
<if test="item.communityId != null and item.communityId != '' ">
|
community_id=#{item.communityId},
|
</if>
|
<if test="item.userId != null and item.userId != '' ">
|
user_id=#{item.userId},
|
</if>
|
updated_at=sysdate()
|
</set>
|
where id = #{item.id}
|
</update>
|
|
<select id="selectUserList" resultType="com.panzhihua.common.model.vos.user.SysUserVO">
|
select su.user_id,su.phone,su.nick_name,su.name,su.community_id,caiu.integral_available_sum as loveIntegral
|
from sys_user as su
|
left join com_act_integral_user as caiu on caiu.user_id=su.user_id
|
<where>
|
1=1
|
and su.app_id='wx118de8a734d269f0'
|
<if test="communityId!=null and communityId !='' ">
|
and su.community_id=#{communityId} and caiu.community_id=#{communityId}
|
</if>
|
<if test="phoneOrname!=null and phoneOrname !=''">
|
and (su.name like concat ('%',#{phoneOrname},'%') or
|
su.phone like concat ('%',#{phoneOrname},'%') or
|
su.nick_name like concat ('%',#{phoneOrname},'%')
|
)
|
</if>
|
|
</where>
|
</select>
|
|
|
<select id="selectUserListB" resultType="com.panzhihua.common.model.vos.user.SysUserVO">
|
select su.user_id,su.phone,su.nick_name,su.name,su.community_id
|
from sys_user as su
|
<where>
|
1=1
|
and su.app_id='wx118de8a734d269f0'
|
<if test="communityId!=null and communityId !='' ">
|
and su.community_id=#{communityId}
|
</if>
|
<if test="phoneOrname!=null and phoneOrname !=''">
|
and (su.name like concat ('%',#{phoneOrname},'%') or
|
su.phone like concat ('%',#{phoneOrname},'%') or
|
su.nick_name like concat ('%',#{phoneOrname},'%')
|
)
|
</if>
|
|
</where>
|
</select>
|
|
|
|
<select id="selectUserBind" resultType="String">
|
select id from new_fight_com_convenient_merchants
|
<where>
|
1=1
|
<if test="communityId!=null and communityId !='' ">
|
and community_id=#{communityId}
|
</if>
|
<if test="userId!=null and userId !='' ">
|
and user_id=#{userId}
|
</if>
|
</where>
|
</select>
|
|
|
|
|
</mapper>
|