危化品全生命周期管理后端
kongzy
2024-08-22 0c73654f55844e34772732914af8cc1e247aab63
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
<?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.gkhy.hazmat.system.mapper.SysCompanyMapper">
    <resultMap type="com.gkhy.hazmat.system.domain.SysCompany" id="SysCompanyResult">
        <result property="id"       column="id"       />
        <result property="name"    column="name"    />
        <result property="creditCode"     column="credit_code"     />
        <result property="major"  column="major"  />
        <result property="phone"         column="phone"          />
        <result property="delFlag"         column="del_flag"          />
        <result property="version"         column="version"          />
        <result property="createBy"       column="create_by"       />
        <result property="createTime"     column="create_time"     />
        <result property="updateBy"       column="update_by"       />
        <result property="updateTime"     column="update_time"     />
        <result property="remark"         column="remark"          />
 
    </resultMap>
 
    <sql id="selectCompanyVo">
        select id, name, credit_code, major, phone,version, create_by, create_time, update_by, update_time, remark
        from sys_company
    </sql>
 
    <select id="selectCompanyList" resultMap="SysCompanyResult">
        <include refid="selectCompanyVo"/>
        <where>
            and del_flag=0
            <if test="name != null and name != ''">
                AND name like concat('%', #{name}, '%')
            </if>
            <if test="creditCode != null and creditCode != ''">
                AND credit_code like concat('%', #{creditCode}, '%')
            </if>
            <if test="id!=null">
                AND id=#{id}
            </if>
        </where>
        order by id desc
    </select>
 
    <select id="selectCompanyById" resultMap="SysCompanyResult">
        <include refid="selectCompanyVo"/>
        where id=#{companyId}
    </select>
 
 
    <update id="delCompanyById">
        update sys_company set del_flag=1 where id=#{companyId}
    </update>
 
    <select id="checkNameUnique" resultMap="SysCompanyResult">
        select id,name from sys_company where name=#{name} and del_flag=0 limit 1
    </select>
 
 
 
</mapper>