kongzy
2024-06-24 4910e41f81a85c03a9dfc83f8ec9c1e71c123d49
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
<?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.exam.system.mapper.SysCompanyMapper">
    <resultMap type="com.gkhy.exam.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="remainPeriod"         column="remain_period"          />
        <result property="spendPeriod"         column="spend_period"          />
        <result property="totalPeriod"         column="total_period"          />
        <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,remain_period,spend_period,total_period,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>
        </where>
        order by create_time 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>