危化品全生命周期管理后端
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
<?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.SysConfigMapper">
 
    <resultMap type="com.gkhy.hazmat.system.domain.SysConfig" id="SysConfigResult">
        <id     property="id"      column="id"      />
        <result property="logoPath"    column="logo_path"    />
        <result property="useProd"     column="use_prod"     />
        <result property="companyId"   column="company_id"   />
        <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="companyName"    column="company_name"    />
    </resultMap>
 
    <sql id="selectConfigVo">
        select a.id, a.logo_path, a.use_prod, a.company_id, a.create_by, a.create_time, a.update_by, a.update_time,b.name as company_name
        from sys_config a
        left join sys_company b on b.id=a.company_id
    </sql>
 
    <!-- 查询条件 -->
    <sql id="sqlwhereSearch">
        <where>
            <if test="id !=null">
                and a.id = #{id}
            </if>
            <if test="companyId !=null">
                and a.company_id = #{companyId}
            </if>
        </where>
    </sql>
 
    <select id="getConfig" resultMap="SysConfigResult">
        <include refid="selectConfigVo"></include>
        <include refid="sqlwhereSearch"></include>
    </select>
 
    <select id="selectConfigList" resultMap="SysConfigResult">
        <include refid="selectConfigVo"/>
        <where>
            <if test="companyId !=null">
                and a.company_id = #{companyId}
            </if>
        </where>
    </select>
 
    <select id="getConfigByCompanyId" resultType="com.gkhy.hazmat.system.domain.SysConfig"
            parameterType="java.lang.Long">
        select * from sys_config where company_id=#{companyId}
    </select>
</mapper>