WarningCompanyMapper.xml
3.04 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
<?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.credit.cy.business.mapper.WarningCompanyMapper">
<resultMap type="WarningCompany" id="WarningCompanyResult">
<result property="wcId" column="wc_id" />
<result property="enterpriseName" column="enterprise_name" />
<result property="creditCode" column="credit_code" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectWarningCompanyVo">
select wc_id, enterprise_name, credit_code, create_time from warning_company
</sql>
<select id="selectWarningCompanyList" parameterType="WarningCompany" resultMap="WarningCompanyResult">
<include refid="selectWarningCompanyVo"/>
<where>
<if test="enterpriseName != null and enterpriseName != ''"> and enterprise_name like concat('%', #{enterpriseName}, '%')</if>
<if test="creditCode != null and creditCode != ''"> and credit_code = #{creditCode}</if>
</where>
</select>
<select id="selectWarningCompanyByWcId" parameterType="Long" resultMap="WarningCompanyResult">
<include refid="selectWarningCompanyVo"/>
where wc_id = #{wcId}
</select>
<insert id="insertWarningCompany" parameterType="WarningCompany">
insert into warning_company
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="wcId != null">wc_id,</if>
<if test="enterpriseName != null and enterpriseName != ''">enterprise_name,</if>
<if test="creditCode != null and creditCode != ''">credit_code,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="wcId != null">#{wcId},</if>
<if test="enterpriseName != null and enterpriseName != ''">#{enterpriseName},</if>
<if test="creditCode != null and creditCode != ''">#{creditCode},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateWarningCompany" parameterType="WarningCompany">
update warning_company
<trim prefix="SET" suffixOverrides=",">
<if test="enterpriseName != null and enterpriseName != ''">enterprise_name = #{enterpriseName},</if>
<if test="creditCode != null and creditCode != ''">credit_code = #{creditCode},</if>
<if test="createTime != null">create_time = #{createTime},</if>
</trim>
where wc_id = #{wcId}
</update>
<delete id="deleteWarningCompanyByWcId" parameterType="Long">
delete from warning_company where wc_id = #{wcId}
</delete>
<delete id="deleteWarningCompanyByWcIds" parameterType="String">
delete from warning_company where wc_id in
<foreach item="wcId" collection="array" open="(" separator="," close=")">
#{wcId}
</foreach>
</delete>
</mapper>