一对多查询子查询条件 非主查询公有

<resultMap type="com.dny.website.entity.AllianceBusiness" id="ABMap">
        <id column="aid" property="alliance_id"/>
        <result column="name" property="name"/>
        <result column="gender" property="gender"/>
        <result column="telephone" property="telephone"/>
        <result column="wechat" property="wechat"/>
        <result column=" province" property=" province"/>
        <result column="city" property="city"/>
        <result column="area" property="area"/>
        <result column="detailed_address" property="detailed_address"/>
        <result column="store_area" property="store_area"/>
        <result column=" product" property=" product"/>
        <result column="come_round" property="come_round"/>
        <result column="come_round_time" property="come_round_time"/>
        <result column="come_round_number" property="come_round_number"/>
        <result column="remark" property="remark"/>
        <result column="star" property="star"/>
        <result column="signing" property="signing"/>
        <result column="earnest" property="earnest"/>
        <result column="earnest_time" property="earnest_time"/>
        <result column="aggregate_investment" property="aggregate_investment"/>
        <result column=" payment_remark" property=" payment_remark"/>
        <result column="client_principal" property="client_principal"/>
        <result column="treaters" property="treaters"/>
        <result column="source" property="source"/>
        <result column="summary" property="summary"/>
        <result column="mimTime" property="mimTime"/>
        <result column="maxTime" property="maxTime"/>
        <!-- 谈判内容 一对多 -->
        <collection property="ABCList" ofType="com.dny.website.entity.AllianceBusinessCommunicate" column="aid" select="selectAllABC">
            <result column="communicate_time" property="communicate_time"/>
            <result column="content" property="content"/>        
        </collection>
        <!-- 回款金额 一对多 -->
         <collection property="ABRMList" ofType="com.dny.website.entity.AllianceBusinessReturnedMoney"
            column="{aid=aid,minTime=minTime,maxTime=maxTime}" select="selectAllABRM">
            <result column="degree" property="degree"/>
            <result column="time" property="time"/>    
            <result column="degree_money" property="degree_money"/>
        </collection> 
    </resultMap>
    <!-- 查询所有加盟商信息 -->
    <select id="selectAllAB" resultMap="ABMap">
        SELECT
             #{minTime}  as minTime,
             #{maxTime}  as maxTime,
            ab.alliance_id as aid,
            ab.NAME,
            ab.gender,
            ab.telephone,
            ab.wechat,
            ab.province,
            ab.city,
            ab.area,
            ab.detailed_address,
            ab.store_area,
            ab.product,
            ab.come_round,
            ab.come_round_time,
            ab.come_round_number,
            ab.remark,
            ab.star,
            ab.signing,
            ab.earnest,
            ab.earnest_time,
            ab.aggregate_investment,
            ab.payment_remark,
            ab.client_principal,
            ab.treaters,
            ab.source,
            (case when aa.sum_money is null then ab.earnest else aa.sum_money+ab.earnest end) as summary
        FROM
            alliance_business AS ab left join (
                SELECT
                    allianceId,
                    sum( degree_money ) as sum_money
                FROM
                    `alliance_business_returned_money` 
                GROUP BY
                    allianceId
                ) as aa on 1 and ab.alliance_id=aa.allianceId
            <where>
                ab.client_principal is not null 
                and ab.client_principal != ''
                <if test="come_round !=null">
                    and ab.come_round=#{come_round}
                </if>
                <if test="star !=null">
                    and ab.star=#{star}
                </if>
                <if test="signing !=null">
                    and ab.signing=#{signing}
                </if>
                <if test="client_principal !=null and client_principal!=''">
                    and ab.client_principal=#{client_principal}
                </if>
                <if test="treaters !=null and treaters !=''">
                    and ab.treaters like CONCAT("%",#{treaters},"%")
                </if>
                <if test="startTime !=null and startTime !=''">
                    and ab.earnest_time>=CONCAT('','${startTime}',' 00:00:00')
                </if>
                <if test="endTime !=null and endTime!=''">
                    and ab.earnest_time &lt;= CONCAT('','${endTime}',' 23:59:59')
                </if>
                <if test="minTime !=null and minTime!=''">
                    and ab.come_round_time>=CONCAT('','${minTime}',' 00:00:00')
                </if>
                <if test="maxTime !=null and maxTime!=''">
                    and ab.come_round_time &lt;= CONCAT('','${maxTime}',' 23:59:59')
                </if>
                <if test="source !=null and source!=''">
                    and ab.source=#{source}
                </if>
                <if test="like !=null and like!=''">
                    and  concat(IFNULL(ab.name,''),IFNULL(ab.telephone,''),IFNULL(ab.wechat,''),IFNULL(ab.province,''),IFNULL(ab.city,''),IFNULL(ab.area,'')) like concat("%",#{like},"%")
                </if>
            </where>
        ORDER BY
            ab.star DESC,
            ab.input_time DESC
    </select>
    <!-- 查询谈判内容 -->
    <select id="selectAllABC" resultType="com.dny.website.entity.AllianceBusinessCommunicate">
        SELECT
            abc.id,
            abc.communicate_time,
            abc.content 
        FROM
            alliance_business_communicate AS abc
        <where>
            abc.allianceId=#{aid}
        </where>
        ORDER BY
            abc.communicate_time desc
    </select>
    <!-- 查询回款情况 -->
    <select id="selectAllABRM" resultType="com.dny.website.entity.AllianceBusinessReturnedMoney">
        SELECT
            abrm.returned_money_id,
            abrm.degree,
            abrm.time,
            abrm.degree_money 
        FROM
            alliance_business_returned_money AS abrm 
        <where>
            abrm.allianceId=#{aid}
            <if test="minTime !=null and minTime!=''">
                    and abrm.time>=CONCAT('',#{minTime,jdbcType=VARCHAR},' 00:00:00')
                </if>
                <if test="maxTime !=null and maxTime!=''">
                    and abrm.time &lt;= CONCAT('',#{maxTime,jdbcType=VARCHAR},' 23:59:59')
                </if>
        </where>
        ORDER BY
            abrm.time desc
    </select>

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
基于微信小程序的家政服务预约系统采用PHP语言和微信小程序技术,数据库采用Mysql,运行软件为微信开发者工具。本系统实现了管理员和客户、员工三个角色的功能。管理员的功能为客户管理、员工管理、家政服务管理、服务预约管理、员工风采管理、客户需求管理、接单管理等。客户的功能为查看家政服务进行预约和发布自己的需求以及管理预约信息和接单信息等。员工可以查看预约信息和进行接单。本系统实现了网上预约家政服务的流程化管理,可以帮助工作人员的管理工作和帮助客户查询家政服务的相关信息,改变了客户找家政服务的方式,提高了预约家政服务的效率。 本系统是针对网上预约家政服务开发的工作管理系统,包括到所有的工作内容。可以使网上预约家政服务的工作合理化和流程化。本系统包括手机端设计和电脑端设计,有界面和数据库。本系统的使用角色分为管理员和客户、员工三个身份。管理员可以管理系统里的所有信息。员工可以发布服务信息和查询客户的需求进行接单。客户可以发布需求和预约家政服务以及管理预约信息、接单信息。 本功能可以实现家政服务信息的查询和删除,管理员添加家政服务信息功能填写正确的信息就可以实现家政服务信息的添加,点击家政服务信息管理功能可以看到基于微信小程序的家政服务预约系统里所有家政服务的信息,在添加家政服务信息的界面里需要填写标题信息,当信息填写不正确就会造成家政服务信息添加失败。员工风采信息可以使客户更好的了解员工。员工风采信息管理的流程为,管理员点击员工风采信息管理功能,查看员工风采信息,点击员工风采信息添加功能,输入员工风采信息然后点击提交按钮就可以完成员工风采信息的添加。客户需求信息关系着客户的家政服务预约,管理员可以查询和修改客户需求信息,还可以查看客户需求的添加时间。接单信息属于本系统里的核心数据,管理员可以对接单的信息进行查询。本功能设计的目的可以使家政服务进行及时的安排。管理员可以查询员工信息,可以进行修改删除。 客户可以查看自己的预约和修改自己的资料并发布需求以及管理接单信息等。 在首页里可以看到管理员添加和管理的信息,客户可以在首页里进行家政服务的预约和公司介绍信息的了解。 员工可以查询客户需求进行接单以及管理家政服务信息和留言信息、收藏信息等。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值