180 lines
6.5 KiB
XML
180 lines
6.5 KiB
XML
<?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.nis.web.dao.configuration.TaskInfoDao">
|
|
<resultMap id="BaseResultMap" type="com.nis.domain.configuration.TaskInfo">
|
|
<id column="id" jdbcType="BIGINT" property="id" />
|
|
<result column="task_name" jdbcType="VARCHAR" property="taskName" />
|
|
<result column="task_org" jdbcType="VARCHAR" property="taskOrg" />
|
|
<result column="task_time" jdbcType="DATE" property="taskTime" />
|
|
<result column="task_desc" jdbcType="VARCHAR" property="taskDesc" />
|
|
<result column="is_valid" jdbcType="INTEGER" property="isValid" />
|
|
<result column="is_audit" jdbcType="INTEGER" property="isAudit" />
|
|
<result column="creator_id" jdbcType="INTEGER" property="creatorId" />
|
|
<result column="create_time" jdbcType="DATE" property="createTime" />
|
|
<result column="editor_id" jdbcType="INTEGER" property="editorId" />
|
|
<result column="edit_time" jdbcType="DATE" property="editTime" />
|
|
<result column="auditor_id" jdbcType="INTEGER" property="auditorId" />
|
|
<result column="audit_time" jdbcType="DATE" property="auditTime" />
|
|
</resultMap>
|
|
<sql id="Base_Column_List">
|
|
id, task_name, task_org, task_time, task_desc, is_valid, is_audit, creator_id, create_time,
|
|
editor_id, edit_time, auditor_id, audit_time
|
|
</sql>
|
|
<!-- 查询有效且通过审核 -->
|
|
<select id="findList" parameterType="com.nis.domain.configuration.TaskInfo" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from task_info t
|
|
where is_valid =1 and is_audit =1
|
|
<if test="id!=null">
|
|
AND id = #{id,jdbcType=BIGINT}
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 查询列表 -->
|
|
<select id="findTaskInfo" resultMap="BaseResultMap">
|
|
select
|
|
r.id AS id,
|
|
r.task_name AS taskName,
|
|
r.task_org AS taskOrg,
|
|
r.task_desc AS taskDesc,
|
|
r.task_time AS taskTime,
|
|
r.is_valid AS isValid,
|
|
r.is_audit AS isAudit,
|
|
s.name AS creatorName,
|
|
r.create_time AS createTime,
|
|
u.name AS editorName,
|
|
r.edit_time AS editTime,
|
|
e.name AS auditorName,
|
|
r.audit_time AS auditTime
|
|
from task_info r
|
|
left join sys_user s on r.creator_id=s.id
|
|
left join sys_user u on r.editor_id=u.id
|
|
left join sys_user e on r.auditor_id=e.id
|
|
<trim prefix="WHERE" prefixOverrides="AND |OR ">
|
|
<if test="page !=null and page.where != null and page.where != ''">
|
|
AND ${page.where}
|
|
</if>
|
|
<if test="isValid == null">
|
|
AND r.IS_VALID != -1
|
|
</if>
|
|
<if test="taskName != null and taskName != ''">
|
|
AND r.task_name like
|
|
<if test="dbName == 'mysql'">CONCAT('%',#{taskName}, '%')</if>
|
|
</if>
|
|
<if test="isAudit != null">
|
|
AND r.is_audit=${isAudit}
|
|
</if>
|
|
<if test="beginDate!=null and beginDate!='' ">
|
|
AND r.task_time >= #{beginDate}
|
|
</if>
|
|
<if test="endDate!=null and endDate!=''">
|
|
AND r.task_time <= #{endDate}
|
|
</if>
|
|
<if test="dobeginDate!=null and dobeginDate!='' ">
|
|
AND r.edit_time >= #{dobeginDate}
|
|
</if>
|
|
<if test="doendDate!=null and doendDate!=''">
|
|
AND r.edit_time <= #{doendDate}
|
|
</if>
|
|
|
|
<!-- 数据范围过滤 -->
|
|
${sqlMap.dsf}
|
|
</trim>
|
|
|
|
<choose>
|
|
<when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
ORDER BY ${page.orderBy},r.is_audit,r.create_time desc
|
|
</when>
|
|
<otherwise>
|
|
ORDER BY r.is_audit,r.create_time desc
|
|
</otherwise>
|
|
</choose>
|
|
</select>
|
|
<!-- 根据来函号查询 -->
|
|
<select id="getTaskInfoByTaskName" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List" />
|
|
from task_info
|
|
where task_name = #{taskName,jdbcType=VARCHAR} and is_valid !=-1
|
|
</select>
|
|
<!-- 根据来id查询 -->
|
|
<select id="getTaskInfoById" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from task_info
|
|
where id = #{id,jdbcType=BIGINT}
|
|
</select>
|
|
<!-- 根据来id查询 -->
|
|
<select id="getTaskInfoByIds" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from task_info
|
|
where id in (${ids})
|
|
</select>
|
|
<insert id="insert" parameterType="com.nis.domain.configuration.TaskInfo">
|
|
insert into task_info (id, task_name, task_org,
|
|
task_time, task_desc, is_valid,
|
|
is_audit, creator_id, create_time,
|
|
editor_id, edit_time, auditor_id,
|
|
audit_time)
|
|
values (#{id,jdbcType=BIGINT}, #{taskName,jdbcType=VARCHAR}, #{taskOrg,jdbcType=VARCHAR},
|
|
#{taskTime,jdbcType=DATE}, #{taskDesc,jdbcType=VARCHAR}, #{isValid,jdbcType=INTEGER},
|
|
#{isAudit,jdbcType=INTEGER}, #{creatorId,jdbcType=INTEGER}, #{createTime,jdbcType=DATE},
|
|
#{editorId,jdbcType=INTEGER}, #{editTime,jdbcType=DATE}, #{auditorId,jdbcType=INTEGER},
|
|
#{auditTime,jdbcType=DATE})
|
|
</insert>
|
|
|
|
<update id="update" parameterType="com.nis.domain.configuration.TaskInfo">
|
|
update task_info
|
|
<set>
|
|
<if test="taskName != null">
|
|
task_name = #{taskName,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="taskOrg != null">
|
|
task_org = #{taskOrg,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="taskTime != null">
|
|
task_time = #{taskTime,jdbcType=DATE},
|
|
</if>
|
|
<if test="taskDesc != null">
|
|
task_desc = #{taskDesc,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="isValid != null">
|
|
is_valid = #{isValid,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="isAudit != null">
|
|
is_audit = #{isAudit,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="creatorId != null">
|
|
creator_id = #{creatorId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="createTime != null">
|
|
create_time = #{createTime,jdbcType=DATE},
|
|
</if>
|
|
<if test="editorId != null">
|
|
editor_id = #{editorId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="editTime != null">
|
|
edit_time = #{editTime,jdbcType=DATE},
|
|
</if>
|
|
<if test="auditorId != null">
|
|
auditor_id = #{auditorId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="auditTime != null">
|
|
audit_time = #{auditTime,jdbcType=DATE},
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=BIGINT}
|
|
</update>
|
|
<!--删除 -->
|
|
<update id="delete" parameterType="long">
|
|
update task_info
|
|
<set>
|
|
<if test="id != null and id != ''">
|
|
is_valid=-1
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=BIGINT} and is_audit !=1
|
|
</update>
|
|
</mapper> |