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
<?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="cn.wisenergy.mapper.WorkProjectMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.wisenergy.model.app.WorkProject">
<id column="id" property="id" />
<result column="oa_project_number" property="oaProjectNumber" />
<result column="project_name" property="projectName" />
<result column="type" property="type" />
<result column="manager_id" property="managerId" />
<result column="manager_name" property="managerName" />
<result column="dept_id" property="deptId" />
<result column="work_time" property="workTime" />
<result column="cost_budget" property="costBudget" />
<result column="is_conclusion" property="isConclusion" />
<result column="start_time" property="startTime" />
<result column="end_time" property="endTime" />
<result column="create_time" property="createTime" />
<result column="modify_time" property="modifyTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, oa_project_number, project_name, type, manager_id, manager_name, dept_id, work_time, cost_budget, is_conclusion,start_time,end_time, create_time, modify_time
</sql>
<sql id="table">
work_project
</sql>
<!--查询条件-->
<sql id="criteria">
<if test="id != null">and id = #{id}</if>
<if test="oaProjectNumber != null">and oa_project_number = #{oaProjectNumber}</if>
<if test="projectName != null">and project_name = #{projectName}</if>
<if test="type != null">and type =#{type}</if>
<if test="managerId != null">and manager_id = #{managerId}</if>
<if test="managerName != null">and manager_name = #{managerName}</if>
<if test="dept_id != null">and dept_id = #{dept_id}</if>
<if test="workTime != null">and work_time =#{workTime}</if>
<if test="costBudget != null">and cost_budget = #{costBudget}</if>
<if test="isConclusion != null">and is_onclusion =#{isConclusion},</if>
<if test="startTime != null">and start_time =#{startTime},</if>
<if test="endTime != null">and end_time =#{endTime},</if>
<if test="createTime != null">and create_time >= #{createTime}</if>
<if test="modifyTime != null">and #{modifyTime} >= modify_time</if>
</sql>
<select id="getProjectsByCriteria" resultMap="BaseResultMap" parameterType="map">
select <include refid="Base_Column_List"/>
from <include refid="table"/>
<where>
<include refid="criteria"/>
</where>
<if test="deptIds != null">
AND dept_id IN
<foreach collection="deptIds" item="deptId" separator="," open="(" close=")">
#{deptId}
</foreach>
</if>
</select>
</mapper>