前端传来的搜索条件 1. pageNum: 1 2. pageSize: 20 3. schoolId: 12 4. clockTime_begin: 2023-08-02 5. clockTime_end: 2023-08-03 ``` <select id="selectAttStudentRecordList" parameterType="AttStudentRecord" resultMap="AttStudentRecordResult"> <include refid="selectAttStudentRecordVo"/> <where> <if test="schoolId != null "> and school_id = #{schoolId}</if> <if test="parentId != null "> and parent_id = #{parentId}</if> <if test="studentId != null "> and student_id = #{studentId}</if> <if test="stuName != null and stuName != ''"> and stu_name like concat('%', #{stuName}, '%')</if> <if test="stuNo != null and stuNo != ''"> and stu_no = #{stuNo}</if> <if test="cardNo != null and cardNo != ''"> and card_no = #{cardNo}</if> <if test="clockType != null "> and clock_type = #{clockType}</if> <if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if> <if test="clock_time != null" > and clock_time =#{clockTime}</if> <if test="channelName != null and channelName != ''"> and channel_name like concat('%', #{channelName}, '%')</if> <if test="deviceId != null "> and device_id = #{deviceId}</if> <if test="tenantId != null "> and tenant_id = #{tenantId}</if> and del_flag = 0 </where> </select> 我在xml文件中的where要怎么写
时间: 2024-04-14 18:29:37 浏览: 119
simplePagination.js:一个简单的jQuery分页插件
你可以根据前端传来的搜索条件,在XML文件的`<where>`标签中编写相应的条件语句。以下是根据你提供的搜索条件示例的XML代码示例:
```xml
<select id="selectAttStudentRecordList" parameterType="AttStudentRecord" resultMap="AttStudentRecordResult">
<include refid="selectAttStudentRecordVo" />
<where>
<if test="schoolId != null ">and school_id = #{schoolId}</if>
<if test="clockTime_begin != null ">and clock_time >= #{clockTime_begin}</if>
<if test="clockTime_end != null ">and clock_time <= #{clockTime_end}</if>
and del_flag = 0
</where>
</select>
```
以上示例中,根据前端传来的搜索条件,我仅添加了`schoolId`和`clockTime`的判断条件。你可以根据需要添加其他条件,如`pageNum`、`pageSize`等。
请注意,示例中使用了`>=`和`<=`来表示大于等于和小于等于的比较操作符,这是因为XML文件中需要使用实体编码来表示特殊字符。
希望这能帮到你!如果有任何进一步的问题,请随时问我。
阅读全文