liu
2026-09-22 0837c3ff473499d8a267924125c776b34cc8b517
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?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.ruoyi.system.mapper.CjStudentBindMapper">
    
    <resultMap type="CjStudentBind" id="CjStudentBindResult">
        <result property="id"    column="id"    />
        <result property="studentId"    column="student_id"    />
        <result property="openidHash"    column="openid_hash"    />
        <result property="bindChannel"    column="bind_channel"    />
        <result property="bindTime"    column="bind_time"    />
        <result property="lastLoginTime"    column="last_login_time"    />
        <result property="status"    column="status"    />
        <result property="remark"    column="remark"    />
    </resultMap>
 
    <sql id="selectCjStudentBindVo">
        select id, student_id, openid_hash, bind_channel, bind_time, last_login_time, status, remark from cj_student_bind
    </sql>
 
    <select id="selectCjStudentBindList" parameterType="CjStudentBind" resultMap="CjStudentBindResult">
        <include refid="selectCjStudentBindVo"/>
        <where>  
            <if test="studentId != null "> and student_id = #{studentId}</if>
            <if test="openidHash != null  and openidHash != ''"> and openid_hash = #{openidHash}</if>
            <if test="bindChannel != null  and bindChannel != ''"> and bind_channel = #{bindChannel}</if>
            <if test="bindTime != null "> and bind_time = #{bindTime}</if>
            <if test="lastLoginTime != null "> and last_login_time = #{lastLoginTime}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectCjStudentBindById" parameterType="Long" resultMap="CjStudentBindResult">
        <include refid="selectCjStudentBindVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertCjStudentBind" parameterType="CjStudentBind" useGeneratedKeys="true" keyProperty="id">
        insert into cj_student_bind
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="studentId != null">student_id,</if>
            <if test="openidHash != null and openidHash != ''">openid_hash,</if>
            <if test="bindChannel != null">bind_channel,</if>
            <if test="bindTime != null">bind_time,</if>
            <if test="lastLoginTime != null">last_login_time,</if>
            <if test="status != null">status,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="studentId != null">#{studentId},</if>
            <if test="openidHash != null and openidHash != ''">#{openidHash},</if>
            <if test="bindChannel != null">#{bindChannel},</if>
            <if test="bindTime != null">#{bindTime},</if>
            <if test="lastLoginTime != null">#{lastLoginTime},</if>
            <if test="status != null">#{status},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>
 
    <update id="updateCjStudentBind" parameterType="CjStudentBind">
        update cj_student_bind
        <trim prefix="SET" suffixOverrides=",">
            <if test="studentId != null">student_id = #{studentId},</if>
            <if test="openidHash != null and openidHash != ''">openid_hash = #{openidHash},</if>
            <if test="bindChannel != null">bind_channel = #{bindChannel},</if>
            <if test="bindTime != null">bind_time = #{bindTime},</if>
            <if test="lastLoginTime != null">last_login_time = #{lastLoginTime},</if>
            <if test="status != null">status = #{status},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteCjStudentBindById" parameterType="Long">
        delete from cj_student_bind where id = #{id}
    </delete>
 
    <delete id="deleteCjStudentBindByIds" parameterType="String">
        delete from cj_student_bind where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <select id="countByStudentIds" resultType="int">
        select count(1) from cj_student_bind where student_id in
        <foreach item="studentId" collection="array" open="(" separator="," close=")">
            #{studentId}
        </foreach>
    </select>
</mapper>