|  |  |  | 
|---|
|  |  |  | times6, amount7, money7, times7, amount8, money8, times8, amount9, money9, times9, | 
|---|
|  |  |  | amount10, money10, times10, amount11, money11, times11, amount12, money12, times12 | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  | <sql id="Base_Column_List_with_alias"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | ${alias}.id, ${alias}.client_id, ${alias}.`year`, | 
|---|
|  |  |  | ${alias}.amount1, ${alias}.money1, ${alias}.times1, ${alias}.amount2, ${alias}.money2, ${alias}.times2, | 
|---|
|  |  |  | ${alias}.amount3, ${alias}.money3, ${alias}.times3, ${alias}.amount4, ${alias}.money4, ${alias}.times4, | 
|---|
|  |  |  | ${alias}.amount5, ${alias}.money5, ${alias}.times5, ${alias}.amount6, ${alias}.money6, ${alias}.times6, | 
|---|
|  |  |  | ${alias}.amount7, ${alias}.money7, ${alias}.times7, ${alias}.amount8, ${alias}.money8, ${alias}.times8, | 
|---|
|  |  |  | ${alias}.amount9, ${alias}.money9, ${alias}.times9, ${alias}.amount10, ${alias}.money10, ${alias}.times10, | 
|---|
|  |  |  | ${alias}.amount11, ${alias}.money11, ${alias}.times11, ${alias}.amount12, ${alias}.money12, ${alias}.times12 | 
|---|
|  |  |  | </sql> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 
|---|
|  |  |  | <!--@mbg.generated--> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | 
|---|
|  |  |  | where id = #{id,jdbcType=BIGINT} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- ////////////////////////////////// --> | 
|---|
|  |  |  | <!-- 查询统计结果                         --> | 
|---|
|  |  |  | <!-- ////////////////////////////////// --> | 
|---|
|  |  |  | <select id="selectCountMonthStatistics" resultType="java.lang.Long"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | count(*) | 
|---|
|  |  |  | from se_client mtb | 
|---|
|  |  |  | where mtb.deleted != 1 | 
|---|
|  |  |  | <trim prefix="and" suffixOverrides="and"> | 
|---|
|  |  |  | <if test="name != null and name != ''"> | 
|---|
|  |  |  | mtb.name like concat('%', #{name}, '%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectClientIds4MonthStatistics" resultType="com.dy.pipIrrGlobal.voSt.VoStClientIdAmountYearRecord"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | mtb.id as clientId | 
|---|
|  |  |  | from se_client mtb | 
|---|
|  |  |  | where mtb.deleted != 1 | 
|---|
|  |  |  | <trim prefix="and" suffixOverrides="and"> | 
|---|
|  |  |  | <if test="name != null and name != ''"> | 
|---|
|  |  |  | mtb.name like concat('%', #{name}, '%') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | order by mtb.id DESC | 
|---|
|  |  |  | <trim prefix="limit " > | 
|---|
|  |  |  | <if test="start != null and count != null"> | 
|---|
|  |  |  | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectMonthStatistics" resultType="com.dy.pipIrrGlobal.voSt.VoStClientAmountMonth"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | mtb.clientNum as clientNum, | 
|---|
|  |  |  | mtb.name as clientName, | 
|---|
|  |  |  | mtb.phone as clientPhone, | 
|---|
|  |  |  | mtb.address as clientAddress, | 
|---|
|  |  |  | <include refid="Base_Column_List_with_alias" > | 
|---|
|  |  |  | <property name="alias" value="stTb"/> | 
|---|
|  |  |  | </include> | 
|---|
|  |  |  | from se_client mtb | 
|---|
|  |  |  | <if test="clientIdsJson != null and clientIdsJson !=''"> | 
|---|
|  |  |  | INNER JOIN JSON_TABLE( | 
|---|
|  |  |  | <!--'[{"clientId":"37142501020100215"},{"clientId":"37142501020100215"}]'--> | 
|---|
|  |  |  | #{clientIdsJson}, | 
|---|
|  |  |  | '$[*]' COLUMNS ( | 
|---|
|  |  |  | clientId BIGINT PATH '$.clientId' | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | ) clientIdTb ON clientIdTb.clientId = mtb.id | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | LEFT JOIN | 
|---|
|  |  |  | ( | 
|---|
|  |  |  | select * | 
|---|
|  |  |  | from st_client_amount_month | 
|---|
|  |  |  | <where> | 
|---|
|  |  |  | <if test="year != null"> | 
|---|
|  |  |  | `year` = #{year,jdbcType=INTEGER} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | ) as stTb on stTb.client_id = mtb.id | 
|---|
|  |  |  | where mtb.deleted != 1 | 
|---|
|  |  |  | order by mtb.id DESC | 
|---|
|  |  |  | <!-- 2025-07-14 因为有clientIdsJson限制了数量,所以不再用limit了 | 
|---|
|  |  |  | <trim prefix="limit " > | 
|---|
|  |  |  | <if test="start != null and count != null"> | 
|---|
|  |  |  | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | --> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- ////////////////////////////////// --> | 
|---|
|  |  |  | <!-- 统计相关                         --> | 
|---|
|  |  |  | <!-- ////////////////////////////////// --> | 
|---|
|  |  |  | <select id="selectByYear" resultMap="BaseResultMap"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | <include refid="Base_Column_List" /> | 
|---|