agreement.md 5.63 KB

合同管理

合同状态

操作 status oprations
暂存 100 3
保存(待审核) 500 3
待审核->驳回 900 3
待审核->审核通过 200 4
审核通过->续约 500 2
续约->审核通过 200 2
续约->驳回 900 2
审核通过->解约 500 1
解约->审核通过 200 1(end_agreement:Y)
解约->驳回 900 1

例如,根据品牌id获取jit供应商,筛选有效合同

<select id="selectValidJitSupplierByAgreementId" resultMap="BaseResultMap">
        <bind name="size" value="@com.yohobuy.platform.common.util.SqlUtils@getSize(agreementIds)" />
        select <include refid="Base_Column_List" />
        from agreement
        <where>
        <if test="agreementIds !=null and size!=0">
            agreement_id in
            <foreach collection="agreementIds" item="agreementId" open="(" separator="," close=")">
                #{agreementId}
            </foreach>
        </if>
        and agreement_end_time > FROM_UNIXTIME(UNIX_TIMESTAMP(),'%Y-%m-%d') and
        operations != 3 and `status` in (200,500,900) and end_agreement = 'N' and business_model = 7
        </where>
</select>

1.根据品牌id获取非JIT供应商的可用分类

2.根据品牌id和JIT供应商ID获取可用分类

接口名: /AgreementRest/getAllSortByBrandId

入参

{
 "brandId":1550,
 "supplierId":"1418"
}

属性名称 类型 例子 说明 是否必填 长度限制
brandId int 1550 品牌ID
supplierId String 1418 供应商ID 可选

1. 对应SQL的操作库表(数据库 erp_supplier,表 clause_settlement)

  <select id="selectByBrandId" resultMap="BaseResultMap" parameterType="java.lang.Short">
        select
        <include refid="Base_Column_List" />
        from clause_settlement
        where brand_id = #{brandId,jdbcType=SMALLINT}
  </select>

2. 对应SQL的操作库表(数据库 erp_supplier, 表 agreement)

<select id="selectByAgreementIds" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from agreement where agreement_id in (${agreementIds})
        and agreement_end_time > FROM_UNIXTIME(UNIX_TIMESTAMP(),'%Y-%m-%d') and operations != 3 and `status` in (200,500,900)
        and end_agreement = 'N' and business_model != 7
</select>

3. 对应SQL的操作库表(数据库 erp_supplier, 表 agreement)

<select id="selectByAgreementIdsAndSupplierId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from agreement where agreement_id in (${agreementIds})
        and agreement_end_time > FROM_UNIXTIME(UNIX_TIMESTAMP(),'%Y-%m-%d') and operations != 3 and `status` in (200,500,900) and end_agreement = 'N'
        and supplier_id=#{supplierId,jdbcType=INTEGER}
    </select>

错误编码


错误码code 消息 说明

返回

{
  "code": 200,
  "data": [
    1
  ],
  "message": "可用分类"
}

根据品牌id获取jit供应商

接口名: /AgreementRest/getJitSupplierByBrandId

入参

{
    "brandId":1550
}

属性名称 类型 例子 说明 是否必填 长度限制
brandId int 1550 品牌ID

1. 对应SQL的操作库表(数据库 erp_supplier,表 clause_settlement)

  <select id="selectByBrandId" resultMap="BaseResultMap" parameterType="java.lang.Short">
        select
        <include refid="Base_Column_List" />
        from clause_settlement
        where brand_id = #{brandId,jdbcType=SMALLINT}
    </select>

2. 对应SQL的操作库表(数据库 erp_supplier,表 agreement)

  <select id="selectValidJitSupplierByAgreementId" resultMap="BaseResultMap">
        <bind name="size" value="@com.yohobuy.platform.common.util.SqlUtils@getSize(agreementIds)" />
        select <include refid="Base_Column_List" />
        from agreement
        <where>
        <if test="agreementIds !=null and size!=0">
            agreement_id in
            <foreach collection="agreementIds" item="agreementId" open="(" separator="," close=")">
                #{agreementId}
            </foreach>
        </if>
        and agreement_end_time > FROM_UNIXTIME(UNIX_TIMESTAMP(),'%Y-%m-%d') and
        operations != 3 and `status` in (200,500,900) and end_agreement = 'N' and business_model = 7
        </where>
  </select>

3. 对应SQL的操作库表(数据库 erp_supplier,表 supplier)

  <select id="selectBySupplierIds" resultMap="BaseResultMap">
        <bind name="size" value="@com.yohobuy.platform.common.util.SqlUtils@getSize(supplierIds)" />
        select
        <include refid="Base_Column_List" />
        from supplier
        where is_freeze = 'N'
        <if test="supplierIds !=null and size!=0">
            and id in
            <foreach collection="supplierIds" item="supplierId" open="(" close=")" separator=",">
                #{supplierId,jdbcType=INTEGER}
            </foreach>
        </if>
    </select>

错误编码


错误码code 消息 说明
500 品牌无关联的jit供应商 合同结算条款没有
500 品牌无关联的jit供应商 合同没有
200 品牌关联的jit供应商

返回

{
  "code": 200,
  "data": [
    {
      "id": 1418,
      "supplierId": 1418,
      "supplierName": "1232323",
      "text": "1232323"
    }
  ],
  "message": "品牌关联的jit供应商"
}