You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

84 lines
2.6 KiB

<?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.ccsens.tall.persist.dao.SysProjectDao">
<resultMap id="resultMap_ProjectInfo" type="com.ccsens.tall.bean.po.SysProject">
<id column="pId" property="id" />
<result column="pCreatorId" property="creatorId" />
<result column="pName" property="name" />
<result column="pDescription" property="description" />
<result column="pAddress" property="address" />
<result column="pBeginTime" property="beginTime" />
<result column="pEndTime" property="endTime" />
</resultMap>
<resultMap id="resultMap_template" type="com.ccsens.tall.bean.vo.ProjectVo$TemplateStatus">
<id column="pId" property="id" />
<result column="pName" property="name" />
<result column="pTemplateStatus" property="templateStatus" />
</resultMap>
<resultMap id="resultMap_project_key" type="com.ccsens.tall.bean.vo.ProjectVo$ProjectByKey">
<id column="pId" property="id" />
<result column="pName" property="name" />
</resultMap>
<select id="findProjectIdByUserId" parameterType="java.util.Map"
resultMap="resultMap_ProjectInfo">
SELECT
p.id as pId,
p.creator_id as pCreatorId,
p.name as pName,
p.description as pDescription,
p.address as pAddress,
p.begin_time as pBeginTime,
p.end_time as pEndTime
FROM
t_sys_user_attention a JOIN t_sys_project p ON a.project_id = p.id
WHERE
a.user_id = #{userId}
AND
p.rec_status = 0
AND
p.template = 0
<if test="startTime != null">
<if test="endTime != null">
and
(
(p.begin_time &lt;= #{startTime} and p.end_time &gt;= #{endTime})
OR
(p.begin_time &gt;= #{startTime} and p.begin_time &lt;= #{endTime})
)
</if>
</if>
ORDER by p.begin_time
</select>
<select id="selectByTemplateStatus" parameterType="java.util.Map" resultMap="resultMap_template">
select
id as pId,
name as pName,
template as pTemplateStatus
from
t_sys_project
where
template=#{templateStatus}
AND
rec_status = 0
</select>
<select id="getProjectByKey" parameterType="java.util.Map" resultMap="resultMap_project_key">
select
s.id as pId,
s.name as pName
from
t_sys_project s JOIN t_sys_user_attention a on s.id = a.project_id
where
a.user_id=#{userId}
AND
s.name like concat('%',#{key},'%')
AND
rec_status = 0
</select>
</mapper>