客户档案的体征、合同展示
This commit is contained in:
		| @@ -6,6 +6,7 @@ | ||||
|  | ||||
|     <resultMap type="SysContract" id="SysContractResult"> | ||||
|         <result property="id" column="id"/> | ||||
|         <result property="customerId" column="customer_id"></result> | ||||
|         <result property="projectId" column="project_id"></result> | ||||
|         <result property="status" column="status"/> | ||||
|         <result property="name" column="name"/> | ||||
| @@ -22,38 +23,39 @@ | ||||
|         <result property="updateBy" column="update_by"/> | ||||
|         <result property="updateTime" column="update_time"/> | ||||
|         <result property="remark" column="remark"/> | ||||
|         <result property="delFlag" column="del_flag"></result> | ||||
|         <!-- 非持久化字段 --> | ||||
|         <result property="projectName" column="project_name"></result> | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="selectSysContractVo"> | ||||
|         select sc.id, sc.project_id, sc.status, sc.name, sc.sign_name, sc.phone, sc.cus_id, sc.serve_time, sc.tutor, sc.serve_promise, sc.amount, | ||||
|         sc.path, sc.create_by, sc.create_time, sc.update_by, sc.update_time, sc.remark,cp.dict_label as project_name | ||||
|         select sc.id, sc.customer_id, sc.project_id, sc.status, sc.name, sc.sign_name, sc.phone, sc.cus_id, sc.serve_time, sc.tutor, sc.serve_promise, sc.amount, | ||||
|         sc.path, sc.create_by, sc.create_time, sc.update_by, sc.update_time, sc.remark, sc.del_flag, cp.dict_label as project_name | ||||
|         from sys_contract as sc | ||||
|         LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') as cp ON cp.dict_value = sc.project_id | ||||
|     </sql> | ||||
|  | ||||
|     <select id="selectSysContractList" parameterType="SysContract" resultMap="SysContractResult"> | ||||
|         <include refid="selectSysContractVo"/> | ||||
|         <where> | ||||
|             <if test="id != null ">and sc.id = #{id}</if> | ||||
|             <if test="status != null ">and sc.status = #{status}</if> | ||||
|             <if test="tutor != null and tutor != '' ">and sc.tutor = #{tutor}</if> | ||||
|             <if test="name != null  and name != ''">and sc.name like concat('%', #{name}, '%')</if> | ||||
|             <if test="phone != null  and phone != ''">and sc.phone = #{phone}</if> | ||||
|         </where> | ||||
|         <include refid="selectSysContractVo"/> where del_flag = 0 | ||||
|         <if test="id != null ">and sc.id = #{id}</if> | ||||
|         <if test="customerId != null">and sc.customer_id = #{customerId}</if> | ||||
|         <if test="status != null ">and sc.status = #{status}</if> | ||||
|         <if test="tutor != null and tutor != '' ">and sc.tutor = #{tutor}</if> | ||||
|         <if test="name != null  and name != ''">and sc.name like concat('%', #{name}, '%')</if> | ||||
|         <if test="phone != null  and phone != ''">and sc.phone = #{phone}</if> | ||||
|         order by create_time desc | ||||
|     </select> | ||||
|  | ||||
|     <select id="selectSysContractById" parameterType="Long" resultMap="SysContractResult"> | ||||
|         <include refid="selectSysContractVo"/> | ||||
|         where sc.id = #{id} | ||||
|         where sc.id = #{id} and del_flag = 0 | ||||
|     </select> | ||||
|  | ||||
|     <insert id="insertSysContract" parameterType="SysContract" useGeneratedKeys="true" keyProperty="id"> | ||||
|         insert into sys_contract | ||||
|         <trim prefix="(" suffix=")" suffixOverrides=","> | ||||
|             <if test="id != null">id,</if> | ||||
|             <if test="customerId != null">customer_id,</if> | ||||
|             <if test="projectId != null">project_id,</if> | ||||
|             <if test="status != null">status,</if> | ||||
|             <if test="name != null and name != ''">name,</if> | ||||
| @@ -73,6 +75,7 @@ | ||||
|         </trim> | ||||
|         <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||
|             <if test="id != null">#{id},</if> | ||||
|             <if test="customerId != null">#{customerId},</if> | ||||
|             <if test="projectId != null">#{projectId},</if> | ||||
|             <if test="status != null">#{status},</if> | ||||
|             <if test="name != null and name != ''">#{name},</if> | ||||
| @@ -95,6 +98,7 @@ | ||||
|     <update id="updateSysContract" parameterType="SysContract"> | ||||
|         update sys_contract | ||||
|         <trim prefix="SET" suffixOverrides=","> | ||||
|             <if test="customerId != null">customer_id = #{customerId},</if> | ||||
|             <if test="projectId != null">project_id = #{projectId},</if> | ||||
|             <if test="status != null">status = #{status},</if> | ||||
|             <if test="name != null and name != ''">name = #{name},</if> | ||||
| @@ -116,11 +120,11 @@ | ||||
|     </update> | ||||
|  | ||||
|     <delete id="deleteSysContractById" parameterType="Long"> | ||||
|         delete from sys_contract where id = #{id} | ||||
|         update sys_contract set del_flag = 1 where id = #{id} | ||||
|     </delete> | ||||
|  | ||||
|     <delete id="deleteSysContractByIds" parameterType="String"> | ||||
|         delete from sys_contract where id in | ||||
|         update sys_contract set del_flag = 1 where id in | ||||
|         <foreach item="id" collection="array" open="(" separator="," close=")"> | ||||
|             #{id} | ||||
|         </foreach> | ||||
|   | ||||
| @@ -144,10 +144,18 @@ | ||||
|         from sys_customer_healthy as sch | ||||
|         left join sys_customer sc on sc.id = sch.customer_id | ||||
|         LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') AS cp ON cp.dict_value = sch.conditioning_project_id | ||||
|  | ||||
|         where sch.del_flag = 0 and sc.del_flag = 0 and sch.id = #{id} | ||||
|     </select> | ||||
|  | ||||
|     <!-- 根据客户ID查询客户健康评估 --> | ||||
|     <select id="selectSysCustomerHealthyByCustomerId" parameterType="Long" resultMap="SysCustomerHealthyResult"> | ||||
|         <include refid="selectSysCustomerHealthyVo"/>,sc.name,sc.phone,cp.dict_label as conditioning_project | ||||
|         from sys_customer_healthy as sch | ||||
|         left join sys_customer sc on sc.id = sch.customer_id | ||||
|         LEFT JOIN (SELECT dict_label, dict_value FROM sys_dict_data WHERE dict_type = 'conditioning_project') AS cp ON cp.dict_value = sch.conditioning_project_id | ||||
|         where sch.del_flag = 0 and sc.del_flag = 0 and sch.customer_id = #{customerId} | ||||
|     </select> | ||||
|  | ||||
|     <insert id="insertSysCustomerHealthy" parameterType="SysCustomerHealthy"> | ||||
|         insert into sys_customer_healthy | ||||
|         <trim prefix="(" suffix=")" suffixOverrides=","> | ||||
|   | ||||
| @@ -67,6 +67,7 @@ | ||||
|         <include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and scps.id = #{id} | ||||
|     </select> | ||||
|  | ||||
|     <!-- 根据客户ID查询用户体征 --> | ||||
|     <select id="selectSysCustomerPhysicalSignsByCusId" parameterType="Long" resultMap="SysCustomerSignResult"> | ||||
|         <include refid="selectSysCustomerPhysicalSigns"/> where scps.del_flag = 0 and sc.del_flag = 0 and scps.customer_id = #{id} | ||||
|     </select> | ||||
|   | ||||
| @@ -317,13 +317,13 @@ | ||||
|         where del_flag = 0 and order_id = #{order_id} | ||||
|     </select> | ||||
|  | ||||
|     <!-- 查询订单信息(用于计算提成) --> | ||||
|     <!-- 查询2021年开始的已审核的订单信息(用于计算提成) --> | ||||
|     <select id="selectSimpleOrderMessage" resultMap="SysOrderResultExtended"> | ||||
|       select o.order_id,o.order_time,o.start_time,o.customer,o.review_status,o.amount,o.serve_time_id,o.give_serve_day,o.after_sale_id,su_sale.nick_name as afterSale_name,o.nutritionist_id,su_nutritionist.nick_name as nutritionist_name | ||||
|       from sys_order o | ||||
|       left join sys_user su_sale on su_sale.user_id = o.after_sale_id and su_sale.del_flag = 0 | ||||
|       left join sys_user su_nutritionist on su_nutritionist.user_id = o.nutritionist_id and su_nutritionist.del_flag = 0 | ||||
|       where o.order_time >= '2021-01-01' | ||||
|       where review_status = 'yes' and o.order_time >= '2021-01-01' | ||||
|       <if test="userId != null"> | ||||
|           and (su_sale.user_id = #{userId} or su_nutritionist.user_id = #{userId}) | ||||
|       </if> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user