• xml、 Dao service 三层参数以及对应关系


    =======service   调用dao用params.put(K,Value);将参数传入后台。

      

    BaseResponse response = new BaseResponse();
    Map<String,Object> params = new HashMap<String,Object>();
    String queryByDay = byday.replaceAll("-","/");
    List<OrderDateQueryList> result = null;
    params.put("masterId", masterId);
    params.put("firstDay", queryByDay);
    params.put("lastDay", queryByDay);
    try {
    result = orderDateQueryDao.findWorkOrderListByMonth(params);
    response.setData(result);
    response.setInfo(ReturnCode.OK);
    response.setReturnCode(ReturnCode.STATUS_200);

    =====Dao

    public interface OrderDateQueryDao {
    List<OrderDateQueryList> findWorkOrderListByMonth(Map<String,Object> params) throws Exception;
    }

    ============xml

    <?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.eaju.dao.OrderDateQueryDao">
    <resultMap type="com.eaju.po.OrderDateQueryList" id="orderDateQueryList">
    <result property="id" column="fid" />
    <result property="workNo" column="work_no" />
    <result property="sendDate" column="send_date" />
    <result property="amount" column="amount" />
    .................
    </resultMap>

    <!-- 按月查询已预约工单信息 -->
    <select id="findWorkOrderListByMonth" parameterType="java.util.HashMap" resultMap="orderDateQueryList">
    <!-- select *
    from (select tt.*, ROWNUM as rn
    from ( -->
    SELECT t.fid,
    t.work_no,
    to_char(t.send_date,'yyyy/mm/dd HH24:mi:ss') send_date,
    to_char(t.complete_date,'yyyy/mm/dd HH24:mi:ss') completeDate,
    (select count(1) from  tb_work_order_item i
      where i.work_order_id = t.fid) item_count
    FROM tb_work_order t
    WHERE
    <![CDATA[
        t.master_id=#{masterId}
        and t.status_display='待服务'
        and to_date(to_char(t.booking_time,'yyyy/mm/dd'),'yyyy/mm/dd')>=to_date(#{firstDay},'yyyy/mm/dd')
        and to_date(to_char(t.booking_time,'yyyy/mm/dd'),'yyyy/mm/dd')<=to_date(#{lastDay},'yyyy/mm/dd')
    ]]>
    order by t.send_date desc
    <!-- ) tt
    where <![CDATA[ROWNUM <= #{rowEnd}]]>) ttt
    where <![CDATA[ttt.rn >= #{rowStart}]]> -->
    </select>


    </mapper>

  • 相关阅读:
    Linux查看进程是否存在及启动或重启
    Leetcode 31.下一个排列 tag数组
    Leetccode 27.移除元素 tag数组
    Leetcode 24:两两交换链表中的节点
    当代90后的焦虑
    典型java面试题
    TD编译环境变量说明
    ubuntu20.04安装TD工具后编译错误
    ssh免密登录在Linux服务器之间的设置
    ubuntu20.04导航栏放到底部
  • 原文地址:https://www.cnblogs.com/21heshang/p/6026846.html
Copyright © 2020-2023  润新知