<?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.stylefeng.guns.modular.system.dao.TUserMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="BaseResultMap" type="com.stylefeng.guns.modular.system.model.TUser">
|
<id column="id" property="id" />
|
<result column="business_license" property="businessLicense" />
|
<result column="company_name" property="companyName" />
|
<result column="email" property="email" />
|
<result column="phone" property="phone" />
|
<result column="set_up_the_time" property="setUpTheTime" />
|
<result column="contact_name" property="contactName" />
|
<result column="contact_email" property="contactEmail" />
|
<result column="contact_phone" property="contactPhone" />
|
<result column="logistics_contact_name" property="logisticsContactName" />
|
<result column="logistics_contact_email" property="logisticsContactEmail" />
|
<result column="logistics_contact_phone" property="logisticsContactPhone" />
|
<result column="redit_limit" property="reditLimit" />
|
<result column="payment_days" property="paymentDays" />
|
<result column="account" property="account" />
|
<result column="password" property="password" />
|
<result column="create_time" property="createTime" />
|
<result column="update_time" property="updateTime" />
|
<result column="remove" property="remove" />
|
<result column="status" property="status" />
|
<result column="group_id" property="groupId" />
|
<result column="parent_id" property="parentId" />
|
<result column="HOME" property="home" />
|
<result column="ACCOUNT_SETTINGS" property="accountSettings" />
|
<result column="MY_REQUIREMENT" property="myRequirement" />
|
<result column="MY_ORDER" property="myOrder" />
|
<result column="MY_COMPLAINT" property="myComplaint" />
|
<result column="MY_BANK_CARD" property="myBankCard" />
|
<result column="MY_ADDRESS" property="myAddress" />
|
<result column="WALLET" property="wallet" />
|
<result column="BILL" property="bill" />
|
<result column="VIEW_DETAILS" property="viewDetails" />
|
<result column="DELETE" property="delete" />
|
<result column="EDIT" property="edit" />
|
<result column="company_id" property="companyId" />
|
</resultMap>
|
|
<!-- 通用查询结果列 -->
|
<sql id="Base_Column_List">
|
id, business_license, company_name, email, phone, set_up_the_time, contact_name, contact_email, contact_phone, logistics_contact_name, logistics_contact_email, logistics_contact_phone, redit_limit, payment_days, account, password, create_time, update_time, remove, status, group_id, parent_id, HOME, ACCOUNT_SETTINGS, MY_REQUIREMENT, MY_ORDER, MY_COMPLAINT, MY_BANK_CARD, MY_ADDRESS, WALLET, BILL, VIEW_DETAILS, DELETE, EDIT
|
</sql>
|
|
<select id="getListCompany" resultType="com.stylefeng.guns.modular.system.model.TUserVo">
|
select id,company_name companyName,contact_name contactName,contact_email contactEmail from t_user
|
where remove =0 and company_id=#{companyId}
|
<if test="name !=null and name !=''">
|
and company_name like concat ("%",#{name},"%")
|
</if>
|
<if test="id !=null and id !=''">
|
and id =#{id}
|
</if>
|
</select>
|
|
|
<select id="getBasicInfo" resultType="com.stylefeng.guns.modular.system.model.TUserBasicInfo">
|
select t1.*,(select address from t_user_address where user_id = #{tUserId} and is_default = 1) address from t_user t1 left join t_user_address t2 on t1.id =t2.user_id where t1.id=#{tUserId}
|
|
</select>
|
<select id="getChildUser" resultType="com.stylefeng.guns.modular.system.model.TUserChild">
|
select id,company_name companyName,contact_phone contactPhone,account,HOME home,ACCOUNT_SETTINGS accountSettings,
|
MY_REQUIREMENT myRequirement, MY_ORDER myOrder, MY_COMPLAINT myComplaint,MY_BANK_CARD myBankCard,MY_ADDRESS myAddress,
|
WALLET wallet, BILL bill, VIEW_DETAILS viewDetails, `DELETE` `delete`, EDIT edit
|
from t_user where parent_id =#{tUserId} and remove =0
|
</select>
|
<select id="getCheckList" resultType="com.stylefeng.guns.modular.system.model.TUserReviewVo">
|
select id,company_name name, email,phone,status state
|
from t_user where parent_id = 0
|
<if test="name !=null and name !=''">
|
and company_name like concat("%",#{name},"%")
|
</if>
|
<if test="state !=null and state !=''">
|
and status =#{state}
|
</if>
|
<if test="state ==null or state ==''">
|
and status in (0,2)
|
</if>
|
|
</select>
|
<select id="groupList" resultType="com.stylefeng.guns.modular.system.model.TGroupVo">
|
select t1.* ,t2.fullname as departmentName,t3.`name` as salesName from t_group t1 left JOIN sys_dept t2 on t1.department_id = t2.id
|
left join sys_user t3 on t1.sales_id = t3.id where t1.remove=0
|
<if test="name !=null and name !=''">
|
and t1.name like concat("%",#{name},"%")
|
</if>
|
|
</select>
|
|
<select id="getInvoices" resultType="com.stylefeng.guns.modular.system.model.InvoicesInfo">
|
select t1.id,t1.company_id companyId,t1.create_time createTime,t1.invoice_number invoiceNumber,t2.`name` companyName,if(sum(t3.price) is null,0,sum(t3.price)) as total from t_order t1 LEFT JOIN t_company t2 on t1.company_id = t2.id left JOIN t_price t3 on t1.id = t3.order_id
|
where t1.`status` = 1 and t1.user_id =#{userId}
|
</select>
|
<select id="getOrderInfo" resultType="com.stylefeng.guns.modular.system.model.InvoicesVo">
|
SELECT
|
t1.id,
|
t1.allTotal amount,
|
t1.invoice_number invoiceNumber,
|
t1.company_id companyId,
|
t2.NAME companyName,
|
t1.pay_time invoiceDate,
|
tu.company_name sCompanyName,
|
t1.shipment_date pickupDate,
|
t4.NAME portName,
|
t1.s_name sContactName,
|
t1.s_phone sContactPhone,
|
t1.accessorial_str chassisService,
|
t1.delivery_date deliveryDate,
|
t1.e_company_name eCompanyName,
|
t1.e_name eContactName,
|
t1.e_phone eContactPhone
|
FROM
|
t_order t1
|
LEFT JOIN t_company t2 ON t1.company_id = t2.id
|
LEFT JOIN t_user tu ON t1.user_id = tu.id
|
LEFT JOIN t_port t4 ON t1.PORT = t4.id
|
where t1.id =#{number}
|
</select>
|
<select id="getOrderInfoOne" resultType="com.stylefeng.guns.modular.system.model.InvoicesVoOne">
|
SELECT
|
t1.id,
|
t1.allTotal amount,
|
t1.invoice_number invoiceNumber,
|
t1.company_id companyId,
|
t2.NAME companyName,
|
t1.pay_time invoiceDate,
|
tu.company_name sCompanyName,
|
t1.shipment_date pickupDate,
|
t4.NAME portName,
|
t1.s_name sContactName,
|
t1.s_phone sContactPhone,
|
t1.accessorial_str chassisService,
|
t1.delivery_date deliveryDate,
|
t1.e_company_name eCompanyName,
|
t1.e_name eContactName,
|
t1.e_phone eContactPhone,
|
t1.paid paid,
|
(t1.allTotal-t1.paid) unPaid,
|
t1.pay_info_state status
|
FROM
|
t_order t1
|
LEFT JOIN t_company t2 ON t1.company_id = t2.id
|
LEFT JOIN t_user tu ON t1.user_id = tu.id
|
LEFT JOIN t_port t4 ON t1.PORT = t4.id
|
where t1.id=#{orderId}
|
</select>
|
|
</mapper>
|