提交 | 用户 | 时间
|
58d006
|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
A |
2 |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
3 |
<mapper namespace="com.mandi.fendan.mapper.Fd_XSTDMXMapper"> |
|
4 |
<sql id="whereSql"> |
|
5 |
<if test="tdls !=null and tdls !='' "> |
|
6 |
and a.tdmx_tdls = #{tdls} |
|
7 |
</if> |
|
8 |
<if test="fdywdh !=null and fdywdh !='' "> |
|
9 |
and a.tdmx_fdywdh = #{fdywdh} |
|
10 |
</if> |
|
11 |
<if test="pch !=null and pch !='' "> |
|
12 |
and a.tdmx_pch = #{pch} |
|
13 |
</if> |
|
14 |
<if test="zcbz !=null "> |
|
15 |
and a.tdmx_sfzc = #{zcbz} |
|
16 |
</if> |
|
17 |
<!-- 为空,都可见;不为空,只有可见 --> |
|
18 |
<if test=" companyNo !=null and companyNo !='' "> |
|
19 |
and case when NOT EXISTS ( SELECT * FROM fd_mx_wlgs WHERE tdmx_tdls = a.tdmx_tdls) then 1 <!-- 全部没分 --> |
|
20 |
when EXISTS ( SELECT * FROM fd_mx_wlgs WHERE tdmx_tdfl = a.tdmx_tdfl AND wlgs_no = #{companyNo} ) then 1 <!-- 分给一个人 --> |
|
21 |
when not EXISTS ( SELECT * FROM fd_mx_wlgs WHERE tdmx_tdfl = a.tdmx_tdfl) and tdmx_fdwlgsbh is null then 1 <!-- 某一个没有分且没人领,全部可见 --> |
|
22 |
when tdmx_fdwlgsbh =#{companyNo} then 1 <!-- 自己领的 --> |
|
23 |
end >0 |
|
24 |
</if> |
|
25 |
</sql> |
|
26 |
|
|
27 |
<select id="getList" parameterType="java.util.Map" resultType="java.util.Map"> |
|
28 |
<choose> |
|
29 |
<when test="pagesize > 0 "> |
|
30 |
select top ${pagesize} * |
|
31 |
</when> |
|
32 |
<otherwise> |
|
33 |
select * |
|
34 |
</otherwise> |
|
35 |
</choose> |
|
36 |
from ( select row_number() |
|
37 |
<choose> |
|
38 |
<when test="sort !=null and sort!='' "> |
|
39 |
over (order by ${sort} ) |
|
40 |
</when> |
|
41 |
<otherwise> |
|
42 |
over (order by a.tdmx_tdfl desc ) |
|
43 |
</otherwise> |
|
44 |
</choose> |
|
45 |
as rownumber,ISNULL(fdc.name, fdcmx.name) mxwlgsName, isnull(fdc.companyNo,tdmx_fdwlgsbh) |
|
46 |
mxwlgsNo,CONVERT(varchar(100), fdb.ctime, 120) ctime,DATEDIFF (mi,fdb.ctime,getdate()) timeMinus , |
|
47 |
(select count(1) from bussinesssheet where exists ( |
|
48 |
select top 1 * from ACT_HI_TASKINST where NAME_ = 'issue_card' and PROC_INST_ID_ = instanceId and (DELETE_REASON_ ='completed' or end_time_ is not null) |
|
49 |
) and bussinessNo = a.tdmx_fdywbh) fkStatus, |
|
50 |
a.* |
|
51 |
from xstdmx_view a |
|
52 |
left join fd_mx_wlgs mxwl on mxwl.tdmx_tdfl = a.tdmx_tdfl |
|
53 |
left join fd_company fdc on mxwl.wlgs_no=fdc.companyNo |
|
54 |
left join fd_bsheet fdb on fdb.bsNo = a.tdmx_fdywbh |
|
55 |
left join fd_company fdcmx on a.tdmx_fdwlgsbh=fdcmx.companyNo |
|
56 |
<where> |
|
57 |
<include refid="whereSql"></include> |
|
58 |
</where> |
|
59 |
) as a where rownumber > #{pagesize}*#{page} |
|
60 |
|
|
61 |
</select> |
|
62 |
|
|
63 |
<select id="countPage" parameterType="Map" resultType="int"> |
|
64 |
select count(1) from xstdmx_view a |
|
65 |
<where> |
|
66 |
<include refid="whereSql"></include> |
|
67 |
</where> |
|
68 |
</select> |
|
69 |
</mapper> |