| | |
| | | |
| | | <select id="selectGdManageDevicePage" resultMap="gdManageDeviceResultMap"> |
| | | select |
| | | md.*, |
| | | bd.dept_name as device_dept_name |
| | | md.*, |
| | | bd.dept_name as device_dept_name |
| | | from |
| | | ja_gd_manage_device md |
| | | ja_gd_manage_device md |
| | | left join |
| | | blade_dept bd on md.create_dept = bd.id::VARCHAR |
| | | /* 修改点1:双向转型对齐,确保 bigint 和 varchar 都能匹配 */ |
| | | blade_dept bd on md.create_dept::text = bd.id::text |
| | | <where> |
| | | and md.is_deleted = 0 |
| | | /* 修改点2:去掉开头多余的 and,保持 SQL 语法严谨 */ |
| | | md.is_deleted = 0 |
| | | <if test="param2.nickname != null and param2.nickname != ''"> |
| | | and md.nickname like concat('%',#{param2.nickname},'%') |
| | | </if> |
| | | <if test="param2.deptId != null"> |
| | | and md.create_dept = #{param2.deptId} |
| | | /* 修改点3:参数过滤也建议加转型,防止 param2.deptId 被 MyBatis 传为 String */ |
| | | and md.create_dept::text = #{param2.deptId}::text |
| | | </if> |
| | | <if test="param2.location != null and param2.location != ''"> |
| | | and md.location like concat('%',#{param2.location},'%') |
| | | </if> |
| | | <if test="param2.modeCode != null and param2.modeCode != ''"> |
| | | and md.mode_code = #{param2.modeCode} |
| | | and md.mode_code::text = #{param2.modeCode}::text |
| | | </if> |
| | | <if test="param2.deviceType != null and param2.deviceType != ''"> |
| | | and md.device_type = #{param2.deviceType} |
| | | and md.device_type::text = #{param2.deviceType}::text |
| | | </if> |
| | | |
| | | </where> |
| | | </select> |
| | | |