QyzxEntInfoMMapper.xml 10.4 KB
Newer Older
yuquan.zhu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
<?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="cn.timer.api.dao.qyzx.QyzxEntInfoMMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.qyzx.QyzxEntInfoM" >
                <id column="id" property="id" />
                <result column="name" property="name" />
                <result column="intro" property="intro" />
                <result column="oper_name" property="operName" />
                <result column="size" property="size" />
                <result column="phone" property="phone" />
                <result column="work_address" property="workAddress" />
                <result column="codes" property="codes" />
                <result column="logo_url" property="logoUrl" />
                <result column="industry_type" property="industryType" />
                <result column="open_channel" property="openChannel" />
                <result column="link_man" property="linkMan" />
                <result column="link_man_phone" property="linkManPhone" />
                <result column="credit_code" property="creditCode" />
                <result column="is_on_stock" property="isOnStock" />
                <result column="level" property="level" />
                <result column="register_time" property="registerTime" />
24 25 26 27 28
                <result column="license_url" property="licenseUrl" />
                <result column="area" property="area" />
                <result column="attest_name" property="attestName" />
                <result column="attest_status" property="attestStatus" />
                <result column="attest_time" property="attestTime" />
yuquan.zhu committed
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
    </resultMap>

    <sql id="Base_Column_List">
                id,
                name,
                intro,
                oper_name,
                size,
                phone,
                work_address,
                codes,
                logo_url,
                industry_type,
                open_channel,
                link_man,
                link_man_phone,
                credit_code,
                is_on_stock,
                level,
48 49 50 51 52 53
                register_time,
                license_url,
                area,
                attest_name,
                attest_status,
                attest_time
yuquan.zhu committed
54 55
    </sql>

翁国栋 committed
56
	<!--
yuquan.zhu committed
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 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201

    <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.qyzx.QyzxEntInfoM">
        INSERT INTO qyzx_ent_info_m
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != name'>
                        name,
                        </if>
                        <if test ='null != intro'>
                        intro,
                        </if>
                        <if test ='null != operName'>
                        oper_name,
                        </if>
                        <if test ='null != size'>
                        size,
                        </if>
                        <if test ='null != phone'>
                        phone,
                        </if>
                        <if test ='null != workAddress'>
                        work_address,
                        </if>
                        <if test ='null != codes'>
                        codes,
                        </if>
                        <if test ='null != logoUrl'>
                        logo_url,
                        </if>
                        <if test ='null != industryType'>
                        industry_type,
                        </if>
                        <if test ='null != openChannel'>
                        open_channel,
                        </if>
                        <if test ='null != linkMan'>
                        link_man,
                        </if>
                        <if test ='null != linkManPhone'>
                        link_man_phone,
                        </if>
                        <if test ='null != creditCode'>
                        credit_code,
                        </if>
                        <if test ='null != isOnStock'>
                        is_on_stock,
                        </if>
                        <if test ='null != registerTime'>
                        register_time
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != name'>
                        #{name},
                        </if>
                        <if test ='null != intro'>
                        #{intro},
                        </if>
                        <if test ='null != operName'>
                        #{operName},
                        </if>
                        <if test ='null != size'>
                        #{size},
                        </if>
                        <if test ='null != phone'>
                        #{phone},
                        </if>
                        <if test ='null != workAddress'>
                        #{workAddress},
                        </if>
                        <if test ='null != codes'>
                        #{codes},
                        </if>
                        <if test ='null != logoUrl'>
                        #{logoUrl},
                        </if>
                        <if test ='null != industryType'>
                        #{industryType},
                        </if>
                        <if test ='null != openChannel'>
                        #{openChannel},
                        </if>
                        <if test ='null != linkMan'>
                        #{linkMan},
                        </if>
                        <if test ='null != linkManPhone'>
                        #{linkManPhone},
                        </if>
                        <if test ='null != creditCode'>
                        #{creditCode},
                        </if>
                        <if test ='null != isOnStock'>
                        #{isOnStock},
                        </if>
                        <if test ='null != registerTime'>
                        #{registerTime}
                        </if>
        </trim>
    </insert>

    <delete id="delete" >
        DELETE FROM qyzx_ent_info_m
        WHERE id = #{id}
    </delete>

    <update id="update" parameterType="cn.timer.api.bean.qyzx.QyzxEntInfoM">
        UPDATE qyzx_ent_info_m
        <set>
                    <if test ='null != name'>name = #{name},</if>
                    <if test ='null != intro'>intro = #{intro},</if>
                    <if test ='null != operName'>oper_name = #{operName},</if>
                    <if test ='null != size'>size = #{size},</if>
                    <if test ='null != phone'>phone = #{phone},</if>
                    <if test ='null != workAddress'>work_address = #{workAddress},</if>
                    <if test ='null != codes'>codes = #{codes},</if>
                    <if test ='null != logoUrl'>logo_url = #{logoUrl},</if>
                    <if test ='null != industryType'>industry_type = #{industryType},</if>
                    <if test ='null != openChannel'>open_channel = #{openChannel},</if>
                    <if test ='null != linkMan'>link_man = #{linkMan},</if>
                    <if test ='null != linkManPhone'>link_man_phone = #{linkManPhone},</if>
                    <if test ='null != creditCode'>credit_code = #{creditCode},</if>
                    <if test ='null != isOnStock'>is_on_stock = #{isOnStock},</if>
                    <if test ='null != registerTime'>register_time = #{registerTime}</if>
        </set>
        WHERE id = #{id}
    </update>


    <select id="load" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM qyzx_ent_info_m
        WHERE id = #{id}
    </select>

    <select id="pageList" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM qyzx_ent_info_m
        LIMIT #{offset}, #{pageSize}
    </select>

    <select id="pageListCount" resultType="java.lang.Integer">
        SELECT count(1)
        FROM qyzx_ent_info_m
    </select>

	 -->
翁国栋 committed
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219
    <select id="companyAdminList" resultType="cn.timer.api.dto.qyzx.EntInfoDto">
        SELECT
        qeim.id AS id,
        qeim.logo_url AS logoUrl,
        qeim.NAME AS NAME,
        qeim.link_man AS linkMan,
        qeim.phone AS linkManPhone,
        qeim.area_name AS areaName,
        count( yme.id ) AS totalNum,
        qeim.register_time AS registerTime,
        qeim.end_time AS endTime,
        IFNULL(a.totlaSpmk,0) as totlaSpmk,
        IFNULL(b.totlaCc,0) as totlaCc
        FROM
        qyzx_ent_info_m qeim
        LEFT JOIN yggl_main_emp yme ON yme.org_code = qeim.id
        LEFT JOIN ( SELECT sas.org_code AS oid, count( sas.id ) AS totlaSpmk FROM spmk_approve_summary sas GROUP BY sas.org_code ) AS a ON a.oid = qeim.id
        LEFT JOIN ( SELECT cc.organization_id AS oid, count( cc.id ) AS totlaCc FROM cms_content cc GROUP BY cc.organization_id ) AS b ON b.oid = qeim.id
翁国栋 committed
220 221
        <where>
            <if test="param.name != null and param.name !=''">
翁国栋 committed
222
                and qeim.NAME like CONCAT('%',#{param.name},'%')
翁国栋 committed
223 224
            </if>
            <if test="param.linkMan != null and param.linkMan !=''">
翁国栋 committed
225
                and qeim.link_man like CONCAT('%',#{param.linkMan},'%')
翁国栋 committed
226 227
            </if>
            <if test="param.linkManPhone != null and param.linkManPhone !=''">
翁国栋 committed
228
                and qeim.phone like CONCAT('%',#{param.linkManPhone},'%')
翁国栋 committed
229 230
            </if>
        </where>
翁国栋 committed
231 232
        GROUP BY
        qeim.id
翁国栋 committed
233
        <if test="param.page.currentPage != null and param.page.totalPage !=null">
翁国栋 committed
234
            limit #{param.page.offset},#{param.page.totalPage}
翁国栋 committed
235 236 237 238 239
        </if>
    </select>

    <select id="companyAdminCount" resultType="java.lang.Integer">
        select count(qeim.id) from qyzx_ent_info_m qeim
翁国栋 committed
240 241 242 243 244 245 246 247 248 249 250
        <where>
            <if test="param.name != null and param.name !=''">
                and qeim.NAME like CONCAT('%',#{param.name},'%')
            </if>
            <if test="param.linkMan != null and param.linkMan !=''">
                and qeim.link_man like CONCAT('%',#{param.linkMan},'%')
            </if>
            <if test="param.linkManPhone != null and param.linkManPhone !=''">
                and qeim.phone like CONCAT('%',#{param.linkManPhone},'%')
            </if>
        </where>
翁国栋 committed
251 252 253 254 255
    </select>

    <select id ="getCompanyList" resultType="java.util.HashMap">
        select id as value , name as label from qyzx_ent_info_m
    </select>
yuquan.zhu committed
256

翁国栋 committed
257
</mapper>