You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
3.0 KiB
72 lines
3.0 KiB
<?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="cc.hiver.mall.debt.mapper.DebtMapper">
|
|
<resultMap id="BaseResultMap" type="cc.hiver.mall.debt.entity.Debt">
|
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
|
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
<result column="del_flag" jdbcType="INTEGER" property="delFlag" />
|
|
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
|
<result column="shop_id" jdbcType="VARCHAR" property="shopId" />
|
|
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
|
<result column="user_name" jdbcType="INTEGER" property="userName" />
|
|
<result column="user_phone" jdbcType="INTEGER" property="userPhone" />
|
|
<result column="user_adress" jdbcType="VARCHAR" property="userAdress" />
|
|
<result column="amount_owed" jdbcType="VARCHAR" property="amountOwed" />
|
|
<result column="user_type" jdbcType="VARCHAR" property="userType" />
|
|
</resultMap>
|
|
|
|
<sql id="Base_Column_List">
|
|
id, create_by, create_time, del_flag, update_by, update_time,shop_id, user_id, user_name, user_phone, user_adress, amount_owed, user_type
|
|
</sql>
|
|
|
|
<!--根据店铺id查询欠款列表-->
|
|
<select id="getDebtByShopId" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from t_debt
|
|
where del_flag = 0
|
|
and shop_id = #{queryDebtVo.shopId,jdbcType=VARCHAR}
|
|
and user_type = #{queryDebtVo.userType,jdbcType=VARCHAR}
|
|
order by create_time desc
|
|
</select>
|
|
|
|
<select id="selectByUserId" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from t_debt
|
|
where del_flag = 0
|
|
and shop_id = #{shopId,jdbcType=VARCHAR}
|
|
and user_id = #{userId,jdbcType=VARCHAR}
|
|
</select>
|
|
|
|
<select id="getDebtByUserIds" parameterType="java.lang.String" resultMap="BaseResultMap">
|
|
select
|
|
<include refid="Base_Column_List"/>
|
|
from t_debt
|
|
where del_flag = 0
|
|
and user_id in
|
|
<foreach close=")" collection="userIds" item="listItem" open="(" separator=",">
|
|
#{listItem}
|
|
</foreach>
|
|
</select>
|
|
|
|
<select id="getAllDebtByShopId" resultType="cc.hiver.mall.debt.vo.DebtOfShopVo">
|
|
select
|
|
IFNULL(sum(amount_owed),0.00) amount_owed,
|
|
count(user_id) person_Count
|
|
from t_debt
|
|
where
|
|
<!-- 欠款金额大于0-->
|
|
amount_owed > 0
|
|
<if test='queryDebtVo.userType == "1"'>
|
|
<!-- 该店铺的供应商-->
|
|
and user_id in (select id from t_supplier where shop_id =#{queryDebtVo.shopId,jdbcType=VARCHAR} and del_flag = '0')
|
|
</if>
|
|
<if test='queryDebtVo.userType == "0"'>
|
|
<!-- 该店铺的客户-->
|
|
and user_id in (select id from t_customer where shop_id =#{queryDebtVo.shopId,jdbcType=VARCHAR} and del_flag = '0')
|
|
</if>
|
|
</select>
|
|
</mapper>
|