sadjv3_java/src/main/resources/mapper/bl/commission/ywy/YwyApplyDao.xml

74 lines
2.8 KiB
XML
Raw Normal View History

2024-08-05 10:18:01 +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.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
from bl_ywy_apply a
inner join tb_user b on a.user_id = b.user_id
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 &lt;= #{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}
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>
</mapper>