CaseInfoMapper.xml
6.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?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.lhcredit.project.business.judicial.mapper.CaseInfoMapper">
<resultMap type="com.lhcredit.project.business.judicial.domain.po.CaseInfo" id="CaseInfoResult">
<id property="cAh" column="c_ah"/>
<result property="firmName" column="firm_name"/>
<result property="cAhYs" column="c_ah_ys"/>
<result property="nAjbs" column="n_ajbs"/>
<result property="nJbfy" column="n_jbfy"/>
<result property="nJbfyCj" column="n_jbfy_cj"/>
<result property="nAjjzjd" column="n_ajjzjd"/>
<result property="nSlcx" column="n_slcx"/>
<result property="cSsdy" column="c_ssdy"/>
<result property="dJarq" column="d_jarq"/>
<result property="nSsdw" column="n_ssdw"/>
<result property="type" column="type"/>
<result property="nAjlx" column="n_ajlx"/>
</resultMap>
<sql id="caseInfoVo">
SELECT id,
firm_name,
c_ah,
c_ah_ys,
n_ajbs,
n_jbfy,
n_jbfy_cj,
n_ajjzjd,
n_slcx,
c_ssdy,
d_jarq,
n_ssdw,
type,
n_ajlx
FROM b_case_info
</sql>
<update id="updateCaseInfo" parameterType="com.lhcredit.project.business.judicial.domain.po.CaseInfo">
update b_case_info
<set>
<if test="caseInfo.cAh != null and caseInfo.cAh != ''">`c_ah` = #{caseInfo.cAh},</if>
<if test="caseInfo.cAhYs != null and caseInfo.cAhYs != ''">`c_ah_ys` = #{caseInfo.cAhYs},</if>
<if test="caseInfo.firmName != null and caseInfo.firmName != ''">`firm_name` = #{caseInfo.firmName},</if>
<if test="caseInfo.nAjbs != null and caseInfo.nAjbs != ''">`n_ajbs` = #{caseInfo.nAjbs},</if>
<if test="caseInfo.nJbfy != null and caseInfo.nJbfy != ''">`n_jbfy`= #{caseInfo.nJbfy},</if>
<if test="caseInfo.nJbfyCj != null and caseInfo.nJbfyCj != ''">`n_jbfy_cj` = #{caseInfo.nJbfyCj},</if>
<if test="caseInfo.nAjjzjd != null and caseInfo.nAjjzjd != ''">`n_ajjzjd` = #{caseInfo.nAjjzjd},</if>
<if test="caseInfo.nSlcx != null and caseInfo.nSlcx != ''">`n_slcx` = #{caseInfo.nSlcx},</if>
<if test="caseInfo.cSsdy != null and caseInfo.cSsdy != ''">`c_ssdy` = #{caseInfo.cSsdy},</if>
<if test="caseInfo.dJarq != null and caseInfo.dJarq != ''">`d_jarq` = #{caseInfo.dJarq},</if>
<if test="caseInfo.nSsdw != null and caseInfo.nSsdw != ''">`n_ssdw` = #{caseInfo.nSsdw},</if>
<if test="caseInfo.type != null and caseInfo.type != ''">`type` = #{caseInfo.type},</if>
<if test="caseInfo.nAjlx != null and caseInfo.nAjlx != ''">`n_ajlx` = #{caseInfo.nAjlx}</if>
</set>
where n_ajbs = #{caseInfo.nAjbs}
</update>
<select id="getCaseInfoByAjbs" resultMap="CaseInfoResult">
<include refid="caseInfoVo"/>
where n_ajbs=#{nAjbs}
</select>
<select id="countCaseTypeByFirmName" resultType="java.util.Map">
SELECT mt.monitor_col AS type,
COUNT(ci.type) AS caseNum,
SUM(CASE WHEN ci.n_ajjzjd = '已结案' THEN 1 ELSE 0 END) AS jiean,
SUM(CASE WHEN ci.n_ajjzjd != '已结案' THEN 1 ELSE 0 END) AS weijiean
FROM `monitor_type` AS mt
LEFT JOIN `b_case_info` AS ci ON mt.type = ci.type AND ci.firm_name = #{name}
WHERE mt.type IN ('5029','5030','5031','5032','5033','5034')
GROUP BY mt.monitor_col
</select>
<select id="findALLByFirmName" resultMap="CaseInfoResult">
<include refid="caseInfoVo"/>
where firm_name=#{name}
</select>
<select id="wjajNum" resultType="com.alibaba.fastjson.JSONObject">
SELECT SUM(CASE WHEN n_ajjzjd != '已结案' THEN 1 ELSE 0 END) AS wjaNum,
SUM(CASE WHEN n_ssdw LIKE '%被告%' AND n_ajjzjd != '已结案' THEN 1 ELSE 0 END) AS wjabgNum
FROM b_case_info
WHERE firm_name = #{name};
</select>
<insert id="insertCaseInfo" parameterType="com.lhcredit.project.business.judicial.domain.po.CaseInfo"
useGeneratedKeys="true" keyProperty="id">
insert into b_case_info(
<if test="caseInfo.cAh != null and caseInfo.cAh != ''">`c_ah`,</if>
<if test="caseInfo.firmName != null and caseInfo.firmName != ''">`firm_name`,</if>
<if test="caseInfo.cAhYs != null and caseInfo.cAhYs != ''">`c_ah_ys`,</if>
<if test="caseInfo.nAjbs != null and caseInfo.nAjbs != ''">`n_ajbs`,</if>
<if test="caseInfo.nJbfy != null and caseInfo.nJbfy != ''">`n_jbfy`,</if>
<if test="caseInfo.nJbfyCj != null and caseInfo.nJbfyCj != ''">`n_jbfy_cj`,</if>
<if test="caseInfo.nAjjzjd != null and caseInfo.nAjjzjd != ''">`n_ajjzjd`,</if>
<if test="caseInfo.nSlcx != null and caseInfo.nSlcx != ''">`n_slcx`,</if>
<if test="caseInfo.cSsdy != null and caseInfo.cSsdy != ''">`c_ssdy`,</if>
<if test="caseInfo.dJarq != null and caseInfo.dJarq != ''">`d_jarq`,</if>
<if test="caseInfo.nSsdw != null and caseInfo.nSsdw != ''">`n_ssdw`,</if>
<if test="caseInfo.type != null and caseInfo.type != ''">`type`,</if>
<if test="caseInfo.nAjlx != null and caseInfo.nAjlx != ''">`n_ajlx`</if>
)values(
<if test="caseInfo.cAh != null and caseInfo.cAh != ''">#{caseInfo.cAh,jdbcType=VARCHAR},</if>
<if test="caseInfo.firmName != null and caseInfo.firmName != ''">#{caseInfo.firmName,jdbcType=VARCHAR},</if>
<if test="caseInfo.cAhYs != null and caseInfo.cAhYs != ''">#{caseInfo.cAhYs,jdbcType=VARCHAR},</if>
<if test="caseInfo.nAjbs != null and caseInfo.nAjbs != ''">#{caseInfo.nAjbs,jdbcType=VARCHAR},</if>
<if test="caseInfo.nJbfy != null and caseInfo.nJbfy != ''">#{caseInfo.nJbfy,jdbcType=VARCHAR},</if>
<if test="caseInfo.nJbfyCj != null and caseInfo.nJbfyCj != ''">#{caseInfo.nJbfyCj,jdbcType=VARCHAR},</if>
<if test="caseInfo.nAjjzjd != null and caseInfo.nAjjzjd != ''">#{caseInfo.nAjjzjd,jdbcType=VARCHAR},</if>
<if test="caseInfo.nSlcx != null and caseInfo.nSlcx != ''">#{caseInfo.nSlcx,jdbcType=VARCHAR},</if>
<if test="caseInfo.cSsdy != null and caseInfo.cSsdy != ''">#{caseInfo.cSsdy,jdbcType=VARCHAR},</if>
<if test="caseInfo.dJarq != null and caseInfo.dJarq != ''">#{caseInfo.dJarq,jdbcType=VARCHAR},</if>
<if test="caseInfo.nSsdw != null and caseInfo.nSsdw != ''">#{caseInfo.nSsdw,jdbcType=VARCHAR},</if>
<if test="caseInfo.type != null and caseInfo.type != ''">#{caseInfo.type,jdbcType=VARCHAR},</if>
<if test="caseInfo.nAjlx != null and caseInfo.nAjlx != ''">#{caseInfo.nAjlx,jdbcType=VARCHAR}</if>
)
</insert>
</mapper>