1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-05 15:01:23 +08:00
Files
Pinnacle-OA/Pinnacle/src/main/resources/mapper/WorkMapper.xml
2023-05-15 11:25:54 +08:00

119 lines
4.0 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.cfive.pinnacle.mapper.WorkMapper">
<resultMap id="workMap" type="work">
<id property="id" column="id"/>
<result property="content" column="content"/>
<result property="publisherId" column="publisher_id"/>
<result property="createTime" column="create_time"/>
<result property="deadline" column="deadline"/>
<collection property="userWorkList" ofType="userWork">
<result property="status" column="status"/>
<result property="completeTime" column="complete_time"/>
</collection>
<collection property="worker" ofType="user">
<id property="id" column="worker_id"/>
<result property="username" column="worker_name"/>
</collection>
</resultMap>
<select id="getAll" resultMap="workMap">
select w.id,
content,
publisher_id,
create_time,
deadline,
tuw.user_id worker_id,
u.username worker_name,
tuw.status status,
tuw.complete_time complete_time
from t_work w,
t_user u,
t_user_work tuw
where w.id = tuw.work_id
and tuw.user_id = u.id
and w.deleted = 0
and tuw.deleted = 0
order by w.id desc;
</select>
<select id="getWork" parameterType="long" resultMap="workMap">
select w.id,
content,
publisher_id,
create_time,
deadline,
tuw.user_id worker_id,
u.username worker_name,
tuw.status status,
tuw.complete_time completeTime
from t_work w,
t_user u,
t_user_work tuw
where w.id = #{id}
and w.id = tuw.work_id
and tuw.user_id = u.id
and w.deleted = 0
and tuw.deleted = 0;
</select>
<select id="getWorkByContent" parameterType="String" resultMap="workMap">
select w.id,
content,
publisher_id,
create_time,
deadline,
tuw.user_id worker_id,
u.username worker_name,
tuw.status status,
tuw.complete_time completeTime
from t_work w,
t_user u,
t_user_work tuw
where w.content like '%${content}%'
and w.id = tuw.work_id
and tuw.user_id = u.id
and w.deleted = 0
and tuw.deleted = 0;
</select>
<select id="getTodo" parameterType="long" resultMap="workMap">
select w.id,
content,
publisher_id,
create_time,
deadline,
tuw.user_id worker_id,
u.username worker_name,
tuw.status status
from t_work w,
t_user u,
t_user_work tuw
where w.id = tuw.work_id
and tuw.user_id = u.id
and tuw.user_id = #{userId}
and status = false
and w.deleted = 0
and tuw.deleted = 0
order by w.deadline asc, w.id desc;
</select>
<select id="getComplete" parameterType="long" resultMap="workMap">
select w.id,
content,
publisher_id,
create_time,
deadline,
tuw.user_id worker_id,
u.username worker_name,
tuw.status status,
tuw.complete_time complete_time
from t_work w,
t_user u,
t_user_work tuw
where tuw.user_id = #{userId}
and tuw.user_id = u.id
and w.id = tuw.work_id
and tuw.status = true
and w.deleted = 0
and tuw.deleted = 0
order by w.id desc;
</select>
</mapper>