304 lines
13 KiB
XML
Raw Normal View History

2021-07-19 18:38:42 +08:00
<?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.xhpc.user.mapper.XhpcOperatorMapper">
<resultMap type="com.xhpc.user.domain.XhpcOperator" id="XhpcOperatorResult">
<result column="operator_id" property="operatorId"/>
<result column="name" property="name"/>
<result column="contact_name" property="contactName"/>
<result column="contact_phone" property="contactPhone"/>
<result column="phone" property="phone"/>
<result column="attribute" property="attribute"/>
<result column="area_code" property="areaCode"/>
<result column="address" property="address"/>
<result column="longitude" property="longitude"/>
<result column="latitude" property="latitude"/>
<result column="email" property="email"/>
<result column="commission_type" property="commissionType"/>
<result column="platform_commission_rate" property="platformCommissionRate"/>
<result column="maintenance_commission_rate" property="maintenanceCommissionRate"/>
<result column="business_license_id" property="businessLicenseId"/>
<result column="withdrawal_time" property="withdrawalTime"/>
<result column="soc" property="soc"/>
<result column="status" property="status"/>
<result column="del_flag" property="delFlag"/>
<result column="create_time" property="createTime"/>
<result column="create_by" property="createBy"/>
<result column="update_time" property="updateTime"/>
<result column="update_by" property="updateBy"/>
<result column="remark" property="remark"/>
</resultMap>
<sql id="Base_Column_List">
xo.operator_id operatorId, xo.name, xo.contact_name contactName, xo.contact_phone contactPhone,
2021-07-19 18:38:42 +08:00
xo.phone, xo.attribute, xo.area_code areaCode, xo.address,
xo.longitude, xo.latitude, xo.email, xo.commission_type commissionType,
xo.platform_commission_rate platformCommissionRate,
xo.maintenance_commission_rate maintenanceCommissionRate,
xo.business_license_id businessLicenseId, xo.withdrawal_time withdrawalTime, xo.soc,
xo.status, xo.del_flag delFlag, xo.create_time createTime,
xo.create_by createBy, xo.update_time updateTime, xo.update_by updateBy, xo.remark
</sql>
<insert id="insert" parameterType="com.xhpc.user.domain.XhpcOperator">
insert into xhpc_operator
<trim prefix="(" suffix=")" suffixOverrides=",">
2021-07-19 18:38:42 +08:00
<if test="null != operatorId and '' != operatorId">
operator_id,
</if>
<if test="null != name and '' != name">
name,
</if>
<if test="null != contactName and '' != contactName">
contact_name,
</if>
<if test="null != contactPhone and '' != contactPhone">
contact_phone,
</if>
<if test="null != phone and '' != phone">
phone,
</if>
<if test="null != attribute and '' != attribute">
attribute,
</if>
<if test="null != areaCode and '' != areaCode">
area_code,
</if>
<if test="null != address and '' != address">
address,
</if>
<if test="null != longitude and '' != longitude">
longitude,
</if>
<if test="null != latitude and '' != latitude">
latitude,
</if>
<if test="null != email and '' != email">
email,
</if>
<if test="null != commissionType and '' != commissionType">
commission_type,
</if>
<if test="null != platformCommissionRate and '' != platformCommissionRate">
platform_commission_rate,
</if>
<if test="null != maintenanceCommissionRate and '' != maintenanceCommissionRate">
maintenance_commission_rate,
</if>
<if test="null != businessLicenseId and '' != businessLicenseId">
business_license_id,
</if>
<if test="null != withdrawalTime and '' != withdrawalTime">
withdrawal_time,
</if>
<if test="null != soc and '' != soc">
soc,
</if>
<if test="null != status and '' != status">
status,
</if>
<if test="null != delFlag and '' != delFlag">
del_flag,
</if>
<if test="null != createTime and '' != createTime">
create_time,
</if>
<if test="null != createBy and '' != createBy">
create_by,
</if>
<if test="null != updateTime and '' != updateTime">
update_time,
</if>
<if test="null != updateBy and '' != updateBy">
update_by,
</if>
<if test="null != remark and '' != remark">
remark
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != operatorId and '' != operatorId">
2021-07-19 18:38:42 +08:00
#{operatorId},
</if>
<if test="null != name and '' != name">
#{name},
</if>
<if test="null != contactName and '' != contactName">
#{contactName},
</if>
<if test="null != contactPhone and '' != contactPhone">
#{contactPhone},
</if>
<if test="null != phone and '' != phone">
#{phone},
</if>
<if test="null != attribute and '' != attribute">
#{attribute},
</if>
<if test="null != areaCode and '' != areaCode">
#{areaCode},
</if>
<if test="null != address and '' != address">
#{address},
</if>
<if test="null != longitude and '' != longitude">
#{longitude},
</if>
<if test="null != latitude and '' != latitude">
#{latitude},
</if>
<if test="null != email and '' != email">
#{email},
</if>
<if test="null != commissionType and '' != commissionType">
#{commissionType},
</if>
<if test="null != platformCommissionRate and '' != platformCommissionRate">
#{platformCommissionRate},
</if>
<if test="null != maintenanceCommissionRate and '' != maintenanceCommissionRate">
#{maintenanceCommissionRate},
</if>
<if test="null != businessLicenseId and '' != businessLicenseId">
#{businessLicenseId},
</if>
<if test="null != withdrawalTime and '' != withdrawalTime">
#{withdrawalTime},
</if>
<if test="null != soc and '' != soc">
#{soc},
</if>
<if test="null != status and '' != status">
#{status},
</if>
<if test="null != delFlag and '' != delFlag">
#{delFlag},
</if>
<if test="null != createTime and '' != createTime">
#{createTime},
</if>
<if test="null != createBy and '' != createBy">
#{createBy},
</if>
<if test="null != updateTime and '' != updateTime">
#{updateTime},
</if>
<if test="null != updateBy and '' != updateBy">
#{updateBy},
</if>
<if test="null != remark and '' != remark">
#{remark}
</if>
</trim>
2021-07-19 18:38:42 +08:00
</insert>
<update id="update" parameterType="com.xhpc.user.domain.XhpcOperator">
UPDATE xhpc_operator
<set>
<if test="null != operatorId and '' != operatorId">operator_id = #{operatorId},</if>
<if test="null != name and '' != name">name = #{name},</if>
<if test="null != contactName and '' != contactName">contact_name = #{contactName},</if>
<if test="null != contactPhone and '' != contactPhone">contact_phone = #{contactPhone},</if>
<if test="null != phone and '' != phone">phone = #{phone},</if>
<if test="null != attribute and '' != attribute">attribute = #{attribute},</if>
<if test="null != areaCode and '' != areaCode">area_code = #{areaCode},</if>
<if test="null != address and '' != address">address = #{address},</if>
<if test="null != longitude and '' != longitude">longitude = #{longitude},</if>
<if test="null != latitude and '' != latitude">latitude = #{latitude},</if>
<if test="null != email and '' != email">email = #{email},</if>
<if test="null != commissionType and '' != commissionType">commission_type = #{commissionType},</if>
<if test="null != platformCommissionRate and '' != platformCommissionRate">platform_commission_rate =
#{platformCommissionRate},
</if>
<if test="null != maintenanceCommissionRate and '' != maintenanceCommissionRate">maintenance_commission_rate
= #{maintenanceCommissionRate},
</if>
<if test="null != businessLicenseId and '' != businessLicenseId">business_license_id =
#{businessLicenseId},
</if>
<if test="null != withdrawalTime and '' != withdrawalTime">withdrawal_time = #{withdrawalTime},</if>
<if test="null != soc and '' != soc">soc = #{soc},</if>
<if test="null != status and '' != status">status = #{status},</if>
<if test="null != delFlag and '' != delFlag">del_flag = #{delFlag},</if>
<if test="null != createTime and '' != createTime">create_time = #{createTime},</if>
<if test="null != createBy and '' != createBy">create_by = #{createBy},</if>
<if test="null != updateTime and '' != updateTime">update_time = #{updateTime},</if>
<if test="null != updateBy and '' != updateBy">update_by = #{updateBy},</if>
<if test="null != remark and '' != remark">remark = #{remark}</if>
</set>
WHERE operator_id = #{operatorId}
</update>
<delete id="deleteByIds" parameterType="java.lang.Long">
delete from xhpc_operator where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<select id="checkAccountUnique" parameterType="java.lang.String" resultMap="XhpcOperatorResult">
select * from xhpc_operator where phone = #{phone} limit 1
</select>
<select id="info" parameterType="java.lang.Long" resultType="java.util.Map">
select
<include refid="Base_Column_List"/>,
2021-07-19 18:38:42 +08:00
xdb.dict_value attributenName,`xa`.merger_name mergerName,
GROUP_CONCAT(DISTINCT xi.`url` ORDER BY xi.create_time DESC separator ',') businessLicenseUrl
from xhpc_operator `xo`
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'operator_attribute' and xdb.dict_key = xo.attribute
LEFT JOIN xhpc_area `xa` on `xa`.`code` = xo.area_code
LEFT JOIN xhpc_img xi on FIND_IN_SET(xi.img_id,xo.business_license_id )
where xo.del_flag = 0 and xo.operator_id = #{operatorId}
</select>
<select id="selectOperatorList" parameterType="java.lang.Long" resultType="java.util.Map">
select xo.operator_id operatorId, xo.name, xo.contact_name contactName,
2021-07-19 18:38:42 +08:00
xo.contact_phone contactPhone, xo.phone, xo.attribute,
xdb.dict_value attributenName
from xhpc_operator `xo`
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'operator_attribute' and xdb.dict_key = xo.attribute
where xo.del_flag = 0
<if test="name != null and name != ''">
and xo.name like concat(concat('%', #{name}), '%')
</if>
<if test="contactName != null and contactName != ''">
and xo.contact_name like concat(concat('%', #{contactName}), '%')
</if>
<if test="contactPhone != null and contactPhone != ''">
and xo.contact_phone like concat(concat('%', #{contactPhone}), '%')
</if>
ORDER BY xo.update_time DESC
</select>
2021-07-19 18:38:42 +08:00
<delete id="deleteUserRoleByUserId" parameterType="java.lang.Long">
delete from sys_user_role where user_id=#{userId}
</delete>
<delete id="deleteUserPostByUserId" parameterType="java.lang.Long">
delete from sys_user_post where user_id=#{userId}
</delete>
<update id="deleteUserById" parameterType="java.lang.Long">
update sys_user set del_flag = #{delFlag} where user_id = #{userId}
</update>
<select id="getUserByOperatorId" parameterType="java.lang.Long" resultType="com.ruoyi.system.api.domain.SysUser">
select *
from sys_user
where del_flag = 0 and operator_id = #{operatorId}
</select>
<select id="getOperatorId" resultType="java.util.Map">
select xo.operator_id operatorId, xo.name, xo.contact_name contactName,
xo.contact_phone contactPhone, xo.phone, xo.attribute,
xdb.dict_value attributenName
from xhpc_operator `xo`
LEFT JOIN xhpc_dict_biz xdb on xdb.`code` = 'operator_attribute' and xdb.dict_key = xo.attribute
where xo.del_flag = 0
ORDER BY xo.create_time DESC
</select>
2021-07-19 18:38:42 +08:00
</mapper>