mybatis的xml如何使用java枚举
使用方式
${@com.haier.baseManage.enums.LoganUploadTaskTypeEnum@LOG_TYPE.type}
例子
<?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.baseManage.mapper.LoganUploadTaskMapper">
<sql id="table_cloumn">
t1.id,
t1.user_id,
t1.user_name,
t1.task_no,
t1.log_start_time,
t1.log_end_time,
t1.extend,
t1.if_pull_all_log,
t1.reason,
t1.status,
t1.finish_time,
t1.create_time,
t1.create_by,
t1.create_user_name,
t1.update_time,
t1.update_by,
t1.update_user_name
</sql>
<select id="loganUploadTaskPage"
resultType="com.baseManage.model.entity.LoganUploadTask"
parameterType="com.baseManage.model.param.LoganTaskPageParam">
SELECT
<include refid="table_cloumn" />
FROM logan_upload_task t1
WHERE
1 = 1
<if test=" param.keyword != null and param.keyword != '' ">
AND (
t1.user_name LIKE CONCAT('%',#{param.keyword},'%') OR t1.user_id LIKE CONCAT('%',#{param.keyword},'%')
)
</if>
<if test=" param.status != null">
AND t1.status = #{param.status}
</if>
<if test=" param.logType != null and param.logType != ''">
AND EXISTS(
SELECT 1 FROM logan_upload_task_type t2 WHERE t1.id = t2.task_id
AND t2.type = ${@com.baseManage.enums.LoganUploadTaskTypeEnum@LOG_TYPE.type}
AND t2.name = #{param.logType}
)
</if>
<if test=" param.deviceType != null and param.deviceType != ''">
AND EXISTS(
SELECT 1 FROM logan_upload_task_type t3 WHERE t1.id = t3.task_id
AND t3.type = ${@com.baseManage.enums.LoganUploadTaskTypeEnum@DEVICE_TYPE.type}
AND t3.name = #{param.deviceType}
)
</if>
ORDER BY t1.create_time DESC ,t1.id DESC
</select>
<select id="runningTaskList" parameterType="com.baseManage.model.param.LoganTaskRunningTaskParam" resultType="com.baseManage.model.entity.LoganUploadTask">
SELECT
<include refid="table_cloumn" />
, group_concat(t3.name) logType
FROM logan_upload_task t1
join logan_upload_task_type t2 on t1.id = t2.task_id and t2.type = ${@com.baseManage.enums.LoganUploadTaskTypeEnum@DEVICE_TYPE.type}
join logan_upload_task_type t3 on t1.id = t3.task_id and t3.type = ${@com.baseManage.enums.LoganUploadTaskTypeEnum@LOG_TYPE.type}
WHERE t1.user_id = #{userId}
AND t1.status = ${@[email protected]}
and (t2.name = #{deviceType} or t2.name = 'all')
group by t1.id
</select>
</mapper>
标签:xml,task,java,name,t2,t1,mybatis,type,id
From: https://blog.csdn.net/qq398581645/article/details/140100974