048醫學項目-模組四:採購單模組—採購單受理(Dao,Service,Action三層)

來源:互聯網
上載者:User

標籤:page   頁面   business   response   etc   body   info   參考   9.png   

需求:

我們之前把採購單交給監督單位審核了,審通過的採購單就要受理。供貨商決定採購單發不發貨。

如下:

 

 

這張單子裡面的就是採購單詳細表,這兒查出來的資料就只是特定於這個供貨商的採購單詳細表,一個地區裡面只有一個供貨商,有好幾個醫院,每個醫院有好多個採購單。那麼就是一個供貨商有好幾個採購單。供貨商要看著每一個採購單的明細表才會去處理這個資料要不要發貨。

我們先寫Mapper:

 

我們寫sql時要參考:

 

 Mapper.xml如下:

<!-- 採購單藥品明細查詢列表 -->    <select id="findYycgdmxList" parameterType="yycg.business.pojo.vo.YycgdQueryVo"        resultType="yycg.business.pojo.vo.YycgdmxCustom">        <!-- 引入分頁頭 -->        <include refid="yycg.base.commonSql.page_start" />        select yycgdmx.id yycgdmxid,        useryy.id useryyid,        useryy.mc useryymc,        yycgd.bm yycgdbm,        yycgd.mc yycgdmc,        yycgd.cjtime,        (select info        from dictinfo        where typecode = ‘010‘        and dictcode = yycgd.zt) yycgdztmc,        ypxx.id,        ypxx.bm,        ypxx.mc,        ypxx.jx,        ypxx.gg,        ypxx.zhxs,        ypxx.scqymc,        ypxx.spmc,        ypxx.jyzt,        (select info        from        dictinfo        where ypxx.jyzt =        dictcode        and typecode = ‘003‘) jyztmc,        yycgdmx.zbjg,        yycgdmx.jyjg,        yycgdmx.cgl,        yycgdmx.cgje,        yycgdmx.cgzt,        (select info        from dictinfo        where        typecode = ‘011‘        and dictcode =        yycgdmx.cgzt) cgztmc,        usergys.mc        usergysmc,        usergys.id usergysid        from        yycgdmx${businessyear} yycgdmx,        yycgd${businessyear} yycgd, useryy,        ypxx, usergys        where yycgdmx.yycgdid        = yycgd.id        and yycgd.useryyid =        useryy.id        and yycgdmx.ypxxid = ypxx.id        and yycgdmx.usergysid =        usergys.id        <!-- 只查詢某個採購單下藥品明細 -->        <include refid="query_yycgdmx_where" />        <!-- 採購單查詢條件 -->        <include refid="query_yycgd_where" />        <!-- 藥品查詢條件 -->        <include refid="yycg.business.dao.mapper.YpxxMapperCustom.query_ypxx_where" />        <!-- 分頁尾部 -->        <include refid="yycg.base.commonSql.page_end" />    </select>

我們之前寫過findYycgdmxList。我們這次要做的就是擴充查詢條件,使的之前的findYycgdmxList可以繼續用。

 

    <!-- 採購單藥品明細查詢列表總數 -->    <select id="findYycgdmxCount" parameterType="yycg.business.pojo.vo.YycgdQueryVo"        resultType="int">        select count(*)        from yycgdmx${businessyear} yycgdmx,        yycgd${businessyear} yycgd, useryy,        ypxx, usergys        where yycgdmx.yycgdid        = yycgd.id        and yycgd.useryyid = useryy.id        and yycgdmx.ypxxid = ypxx.id        and yycgdmx.usergysid = usergys.id        <!-- 只查詢某個採購單下藥品明細 -->        <include refid="query_yycgdmx_where" />        <!-- 採購單查詢條件 -->        <include refid="query_yycgd_where" />        <!-- 藥品查詢條件 -->        <include refid="yycg.business.dao.mapper.YpxxMapperCustom.query_ypxx_where" />    </select>
findYycgdmxCount是對應查數量的,用來分頁用的。


 Service 如下:

    @Override    public List<YycgdmxCustom> findDisposeYycgdList(String usergysid,            String year, YycgdQueryVo yycgdQueryVo) throws Exception {        yycgdQueryVo = yycgdQueryVo != null ? yycgdQueryVo : new YycgdQueryVo();        // 供貨商只允許查詢自己供應的採購藥品資訊        // 設定供貨商id        YycgdmxCustom yycgdmxCustom = yycgdQueryVo.getYycgdmxCustom();        yycgdmxCustom = yycgdmxCustom != null ? yycgdmxCustom                : new YycgdmxCustom();        yycgdmxCustom.setUsergysid(usergysid);        // 採購藥品明細狀態為“未確認送貨”        String cgzt = "1";        yycgdmxCustom.setCgzt(cgzt);        yycgdQueryVo.setYycgdmxCustom(yycgdmxCustom);        // 採購單為審核通過        String zt = "3";        YycgdCustom yycgdCustom = yycgdQueryVo.getYycgdCustom();        yycgdCustom = yycgdCustom != null ? yycgdCustom : new YycgdCustom();        yycgdCustom.setZt(zt);        yycgdQueryVo.setYycgdCustom(yycgdCustom);        // 設定年份        yycgdQueryVo.setBusinessyear(year);        return yycgdMapperCustom.findYycgdmxList(yycgdQueryVo);    }    @Override    public int findDisposeYycgdCount(String usergysid, String year,            YycgdQueryVo yycgdQueryVo) throws Exception {        yycgdQueryVo = yycgdQueryVo != null ? yycgdQueryVo : new YycgdQueryVo();        // 供貨商只允許查詢自己供應的採購藥品資訊        // 設定供貨商id        YycgdmxCustom yycgdmxCustom = yycgdQueryVo.getYycgdmxCustom();        yycgdmxCustom = yycgdmxCustom != null ? yycgdmxCustom                : new YycgdmxCustom();        yycgdmxCustom.setUsergysid(usergysid);        // 採購藥品明細狀態為“未確認送貨”        String cgzt = "1";        yycgdmxCustom.setCgzt(cgzt);        yycgdQueryVo.setYycgdmxCustom(yycgdmxCustom);        // 採購單為審核通過        String zt = "3";        YycgdCustom yycgdCustom = yycgdQueryVo.getYycgdCustom();        yycgdCustom = yycgdCustom != null ? yycgdCustom : new YycgdCustom();        yycgdCustom.setZt(zt);        yycgdQueryVo.setYycgdCustom(yycgdCustom);        // 設定年份        yycgdQueryVo.setBusinessyear(year);        return yycgdMapperCustom.findYycgdmxCount(yycgdQueryVo);    }

 

 

 Action層:

// 採購單受理頁面    @RequestMapping("/disposeyycgd")    public String disposeyycgd(Model model) throws Exception {        // 當前年份        model.addAttribute("year", MyUtil.get_YYYY(MyUtil.getDate()));        return "/business/cgd/disposeyycgd";    }    // 採購單受理列表結果集,json    @RequestMapping("/disposeyycgd_result")    public @ResponseBody    DataGridResultInfo disposeyycgd_result(// HttpSession session,            ActiveUser activeUser, String year,// 年份            YycgdQueryVo yycgdQueryVo,// 查詢條件            int page, int rows) throws Exception {        // 供貨商id        String usergysid = activeUser.getSysid();// 單位id        // 列表的總數        int total = cgdService.findDisposeYycgdCount(usergysid, year,                yycgdQueryVo);        // 分頁參數        PageQuery pageQuery = new PageQuery();        pageQuery.setPageParams(total, rows, page);        yycgdQueryVo.setPageQuery(pageQuery);// 設定分頁參數        // 分頁查詢列表        List<YycgdmxCustom> list = cgdService.findDisposeYycgdList(usergysid,                year, yycgdQueryVo);        DataGridResultInfo dataGridResultInfo = new DataGridResultInfo();        dataGridResultInfo.setTotal(total);        dataGridResultInfo.setRows(list);        return dataGridResultInfo;    }

 

 調試通過。

 

048醫學項目-模組四:採購單模組—採購單受理(Dao,Service,Action三層)

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.