<?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.unis.basic.info.modular.gjjmapper.mapper.GjjMapper">



  <!-- 仓储单位信息 -->
  <select id="getDwGjjDate" parameterType="java.lang.String" resultType="java.util.Map">
        SELECT
            id,
            dwdm,
            tydwbm,
            dwmc,
            dwlx,
            DATE_FORMAT(
                    ifnull(zcrq, NOW()),
                    '%Y-%m-%d'
                ) zcrq,
            zczb,
            zcze,
            fddbr,
            frsfzh,
            frlxfs,
            qylxr,
            bgdh,
            CONCAT(
                    zcdz_province,
                    zcdz_city,
                    zcdz_area
                ) zcdz,
            dzyx,
            qygfwzdz,
            czhm,
            yzbm,
            xzqhdm,
            sjdwmc,
            sjdwdm,
            kqs,
            cfs,
            ygs,
            jd,
            wd,
            dwzt,
            czbz,
            DATE_FORMAT(
                    update_time,
                    '%Y-%m-%d %H:%i:%s'
                ) zhgxsj
        FROM
            province_all.biz_unit_info
        where id = #{id}
    </select>
    
    <!-- 储备规模 -->
    <select id="getCbgmGjjDate" parameterType="java.lang.String" resultType="java.util.Map">
        SELECT
            a.id,
            CONCAT(DATE_FORMAT(a.create_time, '%Y'),'年') nf,
            b.xzqhdm,
            b.dwdm ccqy,
            c.enumCode ylpz,
            d.enumCode ylxz,
            a.reserve_plan_quantity ylcbgmjhsl,
            a.cbgmjhwh,
            a.remarks,
            DATE_FORMAT(a.update_time, '%Y-%m-%d %H:%i:%s') zhgxsj
        FROM
            biz_gr_reserve_scale a
                LEFT JOIN  biz_unit_info b on a.unit_info_id = b.id
                LEFT JOIN depot_qh.basic_enum c on c.enumId = a.grain_variety_id
                LEFT JOIN depot_qh.basic_enum d on d.enumId = a.grain_nature_id
        where a.`status` = 2 and a.id = #{id}
    </select>
    
</mapper>