2022-10-08 17:33:31 +08:00
<?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.rzyc.mapper.EntPostListMapper" >
<!-- 通用查询映射结果 -->
<resultMap id= "BaseResultMap" type= "com.rzyc.model.EntPostList" >
<id column= "post_list_id" property= "postListId" />
<result column= "post_id" property= "postId" />
<result column= "ent_user_id" property= "entUserId" />
<result column= "enterprise_id" property= "enterpriseId" />
<result column= "ent_list_id" property= "entListId" />
<result column= "list_id" property= "listId" />
<result column= "item_title" property= "itemTitle" />
<result column= "item_content" property= "itemContent" />
<result column= "sort_id" property= "sortId" />
<result column= "year_num" property= "yearNum" />
<result column= "standard" property= "standard" />
<result column= "frequency" property= "frequency" />
<result column= "finish_state" property= "finishState" />
<result column= "red_alert" property= "redAlert" />
<result column= "yellow_alert" property= "yellowAlert" />
<result column= "del_state" property= "delState" />
<result column= "create_time" property= "createTime" />
<result column= "create_by" property= "createBy" />
<result column= "modify_time" property= "modifyTime" />
<result column= "modify_by" property= "modifyBy" />
<result column= "finishCount" property= "finishCount" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id= "Base_Column_List" >
post_list_id, post_id, ent_user_id, enterprise_id, ent_list_id, list_id, item_title, item_content, sort_id, year_num, standard, frequency, finish_state, red_alert, yellow_alert, del_state, create_time, create_by, modify_time, modify_by
</sql>
2022-12-08 19:48:32 +08:00
<delete id= "deleteEntPostList" >
delete from ent_post_list where ent_user_id = #{entUserId}
</delete>
2022-10-08 17:33:31 +08:00
<select id= "selectEntPostList" resultMap= "BaseResultMap" >
select epl.*,sum(case when task_state = 2 then 1 else 0 end)as finishCount from ent_post_list epl left join ent_post_task ept on epl.post_list_id = ept.post_list_id
where epl.enterprise_id = #{enterpriseId} and epl.ent_user_id = #{entUserId}
2022-11-07 17:47:41 +08:00
<if test= "null != finishedState and '' != finishedState" >
and epl.finish_state = #{finishedState}
</if>
2022-10-08 17:33:31 +08:00
<if test= "null !=postId and '' != postId" >
and epl.post_id = #{postId}
</if>
group by epl.post_list_id
</select>
2022-10-31 17:33:15 +08:00
<select id= "selectEntPostListCount" resultType= "java.lang.Integer" >
2022-11-07 17:47:41 +08:00
select count(post_list_id) from ent_post_list where enterprise_id = #{enterpriseId}
<if test= "null != listId and '' != listId" >
and list_id = #{listId}
</if>
<if test= "null != year" >
and `year_num` = #{year}
</if>
2022-10-31 17:33:15 +08:00
</select>
<select id= "selectEntPostListFinishedCount" resultType= "java.lang.Integer" >
2022-11-07 17:47:41 +08:00
select count(post_list_id) from ent_post_list where enterprise_id = #{enterpriseId}
<if test= "null != listId and '' != listId" >
and list_id = #{listId}
</if>
<if test= "null != state and '' != state" >
and finish_state = #{state}
</if>
<if test= "null != year" >
2022-11-08 18:09:46 +08:00
and `year_num` = #{year}
2022-11-07 17:47:41 +08:00
</if>
</select>
<resultMap id= "EntListGroupMap" type= "com.rzyc.model.EntPostList" >
<result column= "list_id" property= "listId" />
<result column= "item_title" property= "itemTitle" />
<result column= "totalTaskNumber" property= "totalTaskNumber" />
<result column= "haveInHand" property= "haveInHand" />
</resultMap>
<select id= "selectEntListGroupByListId" resultMap= "EntListGroupMap" >
2022-11-18 17:44:17 +08:00
select epl.list_id,il.name as item_title,count(ept.task_id)as totalTaskNumber,sum(case when task_state = 1 then 1 else 0 end)as haveInHand
2022-11-07 17:47:41 +08:00
from ent_post_list epl
2022-11-18 17:44:17 +08:00
left join ent_post_task ept on epl.post_list_id = ept.ent_list_id
left join in_list il on epl.list_id = il.list_id
where epl.enterprise_id = #{enterpriseId}
2022-11-21 17:38:49 +08:00
<if test= "null != userId and '' != userId" >
2022-11-18 17:44:17 +08:00
and epl.ent_user_id = #{userId}
2022-11-21 17:38:49 +08:00
</if>
2022-11-07 17:47:41 +08:00
<if test= "null != listId and '' != listId" >
and epl.list_id = #{listId}
</if>
2022-11-18 17:44:17 +08:00
group by il.list_id
2022-10-31 17:33:15 +08:00
</select>
2022-10-08 17:33:31 +08:00
</mapper>