|
@@ -6,6 +6,7 @@
|
|
|
<resultMap id="projectMap" type="com.siwei.apply.domain.Project">
|
|
|
<id column="id" property="id"/>
|
|
|
<result column="name" property="name"/>
|
|
|
+ <result column="code" property="code"/>
|
|
|
<result column="company" property="company"/>
|
|
|
<result column="created_at" property="createAt"/>
|
|
|
<result column="updated_at" property="updateAt"/>
|
|
@@ -14,9 +15,9 @@
|
|
|
</resultMap>
|
|
|
|
|
|
<insert id="addProject" parameterType="com.siwei.apply.domain.Project">
|
|
|
- INSERT INTO t_project (id, name, company,
|
|
|
+ INSERT INTO t_project (id, name, code, company,
|
|
|
created_at, updated_at, project_type, creator_id)
|
|
|
- VALUES (#{id}, #{name}, #{company}, now(), now(), #{projectType},
|
|
|
+ VALUES (#{id}, #{name}, #{code}, #{company}, now(), now(), #{projectType},
|
|
|
#{creatorId})
|
|
|
</insert>
|
|
|
|
|
@@ -25,4 +26,37 @@
|
|
|
FROM t_project
|
|
|
where t_project.id = #{projectId}
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getProjectList" parameterType="com.siwei.apply.domain.Project">
|
|
|
+ SELECT *
|
|
|
+ FROM t_project
|
|
|
+ <where>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ AND name LIKE CONCAT('%', #{name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="code != null and code != ''">
|
|
|
+ AND code LIKE CONCAT('%', #{code}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="projectType != null and projectType != ''">
|
|
|
+ AND project_type = #{projectType}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY created_at DESC
|
|
|
+ LIMIT #{pageSize} offset #{offset}
|
|
|
+ </select>
|
|
|
+ <select id="getProjectCount" parameterType="com.siwei.apply.domain.Project">
|
|
|
+ SELECT COUNT(*)
|
|
|
+ FROM t_project
|
|
|
+ <where>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ AND name LIKE CONCAT('%', #{name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="code != null and code != ''">
|
|
|
+ AND code LIKE CONCAT('%', #{code}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="projectType != null and projectType != ''">
|
|
|
+ AND project_type = #{projectType}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
</mapper>
|