124 lines
4.8 KiB
XML
124 lines
4.8 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="com.sqx.modules.bl.commission.ywy.dao.YwyApplyDao">
|
|
|
|
<select id="findPage" resultType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
|
select a.id,a.user_id,b.avatar,b.user_name,a.name,a.phone,a.remarks,a.create_time,a.status,a.opinion,a.rate,agent.user_name as agentName,b.invitation_code
|
|
from bl_ywy_apply a
|
|
inner join tb_user b on a.user_id = b.user_id
|
|
left join tb_user agent on b.bl_dls_code = agent.invitation_code
|
|
where 1=1
|
|
<if test="params.status!=null">
|
|
and a.status=#{params.status}
|
|
</if>
|
|
<if test="params.name!=null and params.name!=''">
|
|
and a.name like concat('%',#{params.name},'%')
|
|
</if>
|
|
<if test="params.phone!=null and params.phone!=''">
|
|
and a.phone like concat('%',#{params.phone},'%')
|
|
</if>
|
|
<if test="params.startTime!=null and params.startTime!=''">
|
|
and a.create_time >= #{params.startTime}
|
|
</if>
|
|
<if test="params.endTime!=null and params.endTime!=''">
|
|
and a.create_time <= #{params.endTime}
|
|
</if>
|
|
order by id desc
|
|
</select>
|
|
|
|
<insert id="add" useGeneratedKeys="true" keyProperty="id" parameterType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
|
insert into bl_ywy_apply(user_id,name,phone,remarks,create_time,status)
|
|
values(#{userId},#{name},#{phone},#{remarks},#{createTime},0)
|
|
</insert>
|
|
|
|
<update id="update" parameterType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
|
update bl_ywy_apply
|
|
set
|
|
user_id=#{userId},
|
|
name=#{name},
|
|
phone=#{phone},
|
|
remarks=#{remarks}
|
|
where id=#{id}
|
|
</update>
|
|
|
|
<update id="approve" parameterType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
|
update bl_ywy_apply
|
|
set status=#{status},
|
|
opinion=#{opinion},
|
|
approve_time=#{approveTime},
|
|
approve_user=#{approveUser},
|
|
rate=#{rate}
|
|
where id=#{id}
|
|
</update>
|
|
|
|
<update id="updateRate" parameterType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
|
update bl_ywy_apply
|
|
set rate=#{rate}
|
|
where id=#{id}
|
|
</update>
|
|
|
|
<select id="findUserPage" resultType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
|
select b.user_id,b.avatar,b.user_name,b.phone,b.invitation_code
|
|
from tb_user b
|
|
where b.status = 1
|
|
and b.user_id not in (
|
|
select a.user_id
|
|
from bl_ywy_apply a
|
|
where a.status != 2
|
|
)
|
|
<if test="params.userName!=null and params.userName!=''">
|
|
and b.user_name like concat('%',#{params.userName},'%')
|
|
</if>
|
|
<if test="params.phone!=null and params.phone!=''">
|
|
and b.phone like concat('%',#{params.phone},'%')
|
|
</if>
|
|
<if test="params.invitationCode!=null and params.invitationCode!=''">
|
|
and b.invitation_code like concat('%',#{params.invitationCode},'%')
|
|
</if>
|
|
order by b.user_id
|
|
</select>
|
|
|
|
<select id="invitationQdsPage" resultType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
|
select b.user_id,b.avatar,b.user_name,b.phone,b.invitation_code
|
|
from tb_user b
|
|
where b.status = 1
|
|
and b.bl_is_qds = 1
|
|
and b.bl_ywy_code = #{params.invitationCode}
|
|
<if test="params.userName!=null and params.userName!=''">
|
|
and b.user_name like concat('%',#{params.userName},'%')
|
|
</if>
|
|
<if test="params.phone!=null and params.phone!=''">
|
|
and b.phone like concat('%',#{params.phone},'%')
|
|
</if>
|
|
order by b.user_id
|
|
</select>
|
|
|
|
<select id="invitationQdsNotBindPage" resultType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
|
select b.user_id,b.avatar,b.user_name,b.phone,b.invitation_code
|
|
from tb_user b
|
|
where b.status = 1
|
|
and b.bl_is_qds = 1
|
|
and ifnull(b.bl_ywy_code,'') = ''
|
|
<if test="params.userName!=null and params.userName!=''">
|
|
and b.user_name like concat('%',#{params.userName},'%')
|
|
</if>
|
|
<if test="params.phone!=null and params.phone!=''">
|
|
and b.phone like concat('%',#{params.phone},'%')
|
|
</if>
|
|
order by b.user_id
|
|
</select>
|
|
|
|
<update id="deleteQds" parameterType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
|
update tb_user
|
|
set bl_ywy_code = null
|
|
where user_id=#{userId}
|
|
</update>
|
|
|
|
<insert id="addQds" parameterType="com.sqx.modules.bl.commission.ywy.entity.YwyApply">
|
|
update tb_user
|
|
set bl_ywy_code = #{invitationCode}
|
|
where user_id=#{userId}
|
|
</insert>
|
|
|
|
</mapper> |