123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <?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.caimei.modules.project.dao.ProjectCompanyDao">
-
- <sql id="projectCompanyColumns">
- a.id AS "id",
- a.name AS "name",
- a.area AS "area",
- a.scale AS "scale",
- a.cooperationWay AS "cooperationWay",
- a.maxPerformance AS "maxPerformance",
- a.divideScale AS "divideScale",
- a.starClub AS "starClub",
- a.hotProject AS "hotProject",
- a.shareNum AS "shareNum",
- a.enabledStatus AS "enabledStatus",
- a.createBy AS "createBy.id",
- a.createDate AS "createDate",
- a.updateBy AS "updateBy.id",
- a.updateDate AS "updateDate",
- (select count(1) from project_company_pro b WHERE b.companyId=a.id) AS "projectNum",
- (select count(1) from project_company_pro_marketingconference pm WHERE pm.companyId=a.id) AS "marketingconferenceNum",
- (select count(1) from project_company_apparatus pca WHERE pca.companyId=a.id) AS "apparatusNum"
- </sql>
-
- <sql id="projectCompanyJoins">
- </sql>
-
- <select id="get" resultType="ProjectCompany">
- SELECT
- <include refid="projectCompanyColumns"/>
- FROM project_company a
- <include refid="projectCompanyJoins"/>
- WHERE a.id = #{id}
- </select>
-
- <select id="findByProjectId" resultType="ProjectCompany">
- SELECT
- <include refid="projectCompanyColumns"/>
- FROM project_company a
- LEFT JOIN project_company_pro b ON a.id=b.companyId
- WHERE b.projectId = #{param1}
- </select>
-
- <select id="findList" resultType="ProjectCompany">
- SELECT
- <include refid="projectCompanyColumns"/>
- FROM project_company a
- <include refid="projectCompanyJoins"/>
- <where>
-
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE concat('%',#{name},'%')
- </if>
- <if test="enabledStatus != null and enabledStatus != ''">
- AND a.enabledStatus = #{enabledStatus}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.enabledStatus DESC,a.createDate DESC
- </otherwise>
- </choose>
- </select>
-
- <select id="findAllList" resultType="ProjectCompany">
- SELECT
- <include refid="projectCompanyColumns"/>
- FROM project_company a
- <include refid="projectCompanyJoins"/>
- <where>
-
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.enabledStatus DESC,a.createDate DESC
- </otherwise>
- </choose>
- </select>
-
- <insert id="insert" parameterType="ProjectCompany" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO project_company(
- name,
- area,
- scale,
- cooperationWay,
- maxPerformance,
- divideScale,
- starClub,
- hotProject,
- enabledStatus,
- createBy,
- createDate,
- updateBy,
- updateDate
- ) VALUES (
- #{name},
- #{area},
- #{scale},
- #{cooperationWay},
- #{maxPerformance},
- #{divideScale},
- #{starClub},
- #{hotProject},
- #{enabledStatus},
- #{createBy.id},
- #{createDate},
- #{updateBy.id},
- #{updateDate}
- )
- </insert>
-
- <update id="update">
- UPDATE project_company SET
- name = #{name},
- area = #{area},
- scale = #{scale},
- cooperationWay = #{cooperationWay},
- maxPerformance = #{maxPerformance},
- divideScale = #{divideScale},
- starClub = #{starClub},
- hotProject = #{hotProject},
- enabledStatus = #{enabledStatus},
- updateBy = #{updateBy.id},
- updateDate = #{updateDate}
- WHERE id = #{id}
- </update>
-
- <delete id="delete">
- DELETE FROM project_company WHERE id = #{id}
- </delete>
-
- <update id="updateEnabledStatusByIds">
- UPDATE project_company a SET a.enabledStatus = #{param1}
- WHERE a.id IN
- <foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
- #{id}
- </foreach>
- </update>
- </mapper>
|