341 lines
20 KiB
XML
341 lines
20 KiB
XML
<?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.ruoyi.sip.mapper.ProjectInfoMapper">
|
|
|
|
<resultMap type="ProjectInfo" id="ProjectInfoResult">
|
|
<result property="id" column="id" />
|
|
<result property="projectCode" column="project_code" />
|
|
<result property="projectName" column="project_name" />
|
|
<result property="customerCode" column="customer_code" />
|
|
<result property="customerName" column="customer_name" />
|
|
<result property="industryType" column="industry_type" />
|
|
|
|
<result property="projectStage" column="project_stage" />
|
|
<result property="projectGraspDegree" column="project_grasp_degree" />
|
|
<result property="hzSupportUser" column="hz_support_user" />
|
|
<result property="operateInstitution" column="operate_institution" />
|
|
<result property="partnerCode" column="partner_code" />
|
|
<result property="contactWay" column="contact_way" />
|
|
<result property="estimatedAmount" column="estimated_amount" />
|
|
<result property="currencyType" column="currency_type" />
|
|
<result property="estimatedOrderTime" column="estimated_order_time" />
|
|
<result property="estimatedDeliverTime" column="estimated_deliver_time" />
|
|
<result property="competitor" column="competitor" />
|
|
<result property="countryProduct" column="country_product" />
|
|
<result property="serverConfiguration" column="server_configuration" />
|
|
<result property="keyProblem" column="key_problem" />
|
|
<result property="projectDesc" column="project_desc" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="bgProperty" column="bg_property" />
|
|
</resultMap>
|
|
|
|
<sql id="selectProjectInfoVo">
|
|
select id, project_code, project_name,bg_property, customer_code, customer_name, industry_type, agent_code, project_stage, project_grasp_degree, hz_support_user, operate_institution
|
|
, partner_code, partner_name, contact_way, estimated_amount, currency_type, estimated_order_time, estimated_deliver_time, competitor, country_product, server_configuration
|
|
, key_problem, project_desc, create_by, create_time, update_by, update_time,customer_user_name,customer_phone,partner_email,partner_user_name,h3c_person,h3c_phone,poc from project_info t1
|
|
</sql>
|
|
<sql id="selectRelationProjectInfoVo">
|
|
select t1.id,
|
|
t1.project_code,
|
|
t1.project_name,
|
|
t1.bg_property,
|
|
t1.customer_code,
|
|
t1.customer_name,
|
|
t1.industry_type,
|
|
t1.agent_code,
|
|
t1.project_stage,
|
|
t1.project_grasp_degree,
|
|
t1.hz_support_user,
|
|
t1.operate_institution,
|
|
t1.partner_code,
|
|
t1.partner_name,
|
|
t1.contact_way,
|
|
t1.estimated_amount,
|
|
t1.currency_type,
|
|
t1.estimated_order_time,
|
|
t1.estimated_deliver_time,
|
|
t1.competitor,
|
|
t1.country_product,
|
|
t1.server_configuration,
|
|
t1.key_problem,
|
|
t1.project_desc,
|
|
t1.create_by,
|
|
t1.create_time,
|
|
t1.update_by,
|
|
t1.update_time,
|
|
t1.customer_user_name,t1.customer_phone,t1.partner_user_name,t1.h3c_person,t1.poc,t1.h3c_phone,
|
|
t2.agent_name,t2.contact_email,t2.contact_phone,t2.contact_person,
|
|
t3.user_name as hz_support_user_name,
|
|
t5.level,
|
|
t5.contact_email as partner_email,
|
|
ifnull(t4.work_time,t1.update_time) as last_work_update_time
|
|
from project_info t1
|
|
left join agent_info t2 on t1.agent_code = t2.agent_code
|
|
left join sys_user t3 on t1.hz_support_user=t3.user_id
|
|
left join partner_info t5 on t1.partner_code=t5.partner_code
|
|
left join (select max(work_time) work_time,project_id from project_work_progress group by project_id) t4 ON t1.id=t4.project_id
|
|
|
|
|
|
</sql>
|
|
|
|
<select id="selectProjectInfoList" parameterType="ProjectInfo" resultMap="ProjectInfoResult">
|
|
<include refid="selectRelationProjectInfoVo"/>
|
|
<where>
|
|
<if test="projectCode != null and projectCode != ''"> and t1.project_code = #{projectCode}</if>
|
|
<if test="ids != null and ids != ''"> and find_in_set(t1.id, #{ids})</if>
|
|
<if test="projectName != null and projectName != ''"> and t1.project_name like concat('%', #{projectName}, '%')</if>
|
|
<if test="poc != null and poc != ''"> and t1.poc =#{poc}</if>
|
|
<if test="customerCode != null and customerCode != ''"> and t1.customer_code = #{customerCode}</if>
|
|
<if test="agentCode != null and agentCode != ''"> and t1.agent_code = #{agentCode}</if>
|
|
<if test="agentName != null and agentName != ''"> and t2.agent_name like concat('%', #{agentName}, '%')</if>
|
|
<if test="customerName != null and customerName != ''"> and t1.customer_name like concat('%', #{customerName}, '%')</if>
|
|
<if test="industryType != null and industryType != ''"> and t1.industry_type = #{industryType}</if>
|
|
<if test="bgProperty != null and bgProperty != ''"> and t1.bg_property = #{bgProperty}</if>
|
|
|
|
<if test="projectStage != null and projectStage != ''"> and find_in_set(t1.project_stage , #{projectStage})</if>
|
|
<if test="projectGraspDegree != null and projectGraspDegree != ''"> and t1.project_grasp_degree = #{projectGraspDegree}</if>
|
|
<if test="hzSupportUser != null and hzSupportUser != ''"> and t1.hz_support_user = #{hzSupportUser}</if>
|
|
<if test="hzSupportUserName != null and hzSupportUserName != ''"> and t3.user_name like concat('%', #{hzSupportUserName}, '%')</if>
|
|
<if test="operateInstitution != null and operateInstitution != ''"> and t1.operate_institution = #{operateInstitution}</if>
|
|
<if test="partnerCode != null and partnerCode != ''"> and t1.partner_code = #{partnerCode}</if>
|
|
<if test="partnerName != null and partnerName != ''"> and t1.partner_name = #{partnerName}</if>
|
|
<if test="contactWay != null and contactWay != ''"> and t1.contact_way = #{contactWay}</if>
|
|
<if test="estimatedAmount != null "> and t1.estimated_amount = #{estimatedAmount}</if>
|
|
<if test="currencyType != null and currencyType != ''"> and t1.currency_type = #{currencyType}</if>
|
|
<if test="estimatedOrderTime != null "> and t1.estimated_order_time = #{estimatedOrderTime}</if>
|
|
<if test="estimatedOrderTimeStart != null or estimatedOrderTimeEnd != null">
|
|
<choose>
|
|
<when test="estimatedOrderTimeStart != null and estimatedOrderTimeEnd != null">
|
|
and t1.estimated_order_time between date_format(#{estimatedOrderTimeStart}, '%Y-%m-%d 00:00:00') and date_format(#{estimatedOrderTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
</when>
|
|
<when test="estimatedOrderTimeStart != null">
|
|
and t1.estimated_order_time <![CDATA[ >= ]]> date_format(#{estimatedOrderTimeStart}, '%Y-%m-%d 00:00:00')
|
|
</when>
|
|
<when test="estimatedOrderTimeEnd != null">
|
|
and t1.estimated_order_time <![CDATA[ <= ]]> date_format(#{estimatedOrderTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
</when>
|
|
|
|
</choose>
|
|
</if>
|
|
<if test="estimatedDeliverTime != null "> and t1.estimated_deliver_time = #{estimatedDeliverTime}</if>
|
|
<if test="estimatedDeliverTimeStart != null or estimatedDeliverTimeEnd != null">
|
|
<choose>
|
|
<when test="estimatedDeliverTimeStart != null and estimatedDeliverTimeEnd != null">
|
|
and t1.estimated_deliver_time between date_format(#{estimatedDeliverTimeStart}, '%Y-%m-%d 00:00:00') and date_format(#{estimatedDeliverTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
</when>
|
|
<when test="estimatedDeliverTimeStart != null">
|
|
and t1.estimated_deliver_time <![CDATA[ >= ]]> date_format(#{estimatedDeliverTimeStart}, '%Y-%m-%d 00:00:00')
|
|
</when>
|
|
<when test="estimatedDeliverTimeEnd != null">
|
|
and t1.estimated_deliver_time <![CDATA[ <= ]]> date_format(#{estimatedDeliverTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
</when>
|
|
|
|
</choose>
|
|
|
|
</if>
|
|
<if test="updateTimeStart != null or updateTimeEnd != null">
|
|
<choose>
|
|
<when test="updateTimeStart != null and updateTimeEnd != null">
|
|
and t1.update_time between date_format(#{updateTimeStart}, '%Y-%m-%d 00:00:00') and date_format(#{updateTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
</when>
|
|
<when test="updateTimeStart != null">
|
|
and t1.update_time <![CDATA[ >= ]]> date_format(#{updateTimeStart}, '%Y-%m-%d 00:00:00')
|
|
</when>
|
|
<when test="updateTimeEnd != null">
|
|
and t1.update_time <![CDATA[ <= ]]> date_format(#{updateTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
</when>
|
|
|
|
</choose>
|
|
|
|
</if>
|
|
<if test="lastWorkUpdateTimeStart != null or lastWorkUpdateTimeEnd != null">
|
|
<choose>
|
|
<when test="lastWorkUpdateTimeStart != null and lastWorkUpdateTimeEnd != null">
|
|
and t4.work_time between date_format(#{lastWorkUpdateTimeStart}, '%Y-%m-%d 00:00:00') and date_format(#{lastWorkUpdateTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
</when>
|
|
<when test="lastWorkUpdateTimeStart != null">
|
|
and t4.work_time <![CDATA[ >= ]]> date_format(#{lastWorkUpdateTimeStart}, '%Y-%m-%d 00:00:00')
|
|
</when>
|
|
<when test="lastWorkUpdateTimeEnd != null">
|
|
and t4.work_time <![CDATA[ <= ]]> date_format(#{lastWorkUpdateTimeEnd}, '%Y-%m-%d 23:59:59')
|
|
</when>
|
|
|
|
</choose>
|
|
|
|
</if>
|
|
<if test="competitor != null and competitor != ''"> and t1.competitor = #{competitor}</if>
|
|
<if test="countryProduct != null and countryProduct != ''"> and t1.country_product = #{countryProduct}</if>
|
|
<if test="serverConfiguration != null and serverConfiguration != ''"> and t1.server_configuration = #{serverConfiguration}</if>
|
|
<if test="keyProblem != null and keyProblem != ''"> and t1.key_problem = #{keyProblem}</if>
|
|
<if test="projectDesc != null and projectDesc != ''"> and t1.project_desc = #{projectDesc}</if>
|
|
<if test="canGenerate != null and canGenerate == true">
|
|
and not exists (select 1 from project_order_info t6 where t6.project_id = t1.id)
|
|
</if>
|
|
${params.dataScope}
|
|
</where>
|
|
order by t1.project_code desc
|
|
</select>
|
|
|
|
<select id="selectProjectInfoById" parameterType="Long" resultMap="ProjectInfoResult">
|
|
<include refid="selectRelationProjectInfoVo"/>
|
|
where t1.id = #{id}
|
|
</select>
|
|
<select id="selectMaxProjectCode" resultType="java.lang.String">
|
|
select max(project_code) from project_info where project_code not like 'VD%'
|
|
</select>
|
|
<select id="selectUserById" resultType="com.ruoyi.common.core.domain.entity.SysUser">
|
|
select * from sys_user
|
|
where user_id in <foreach collection="list" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
<select id="listHomePageData" resultType="com.ruoyi.sip.dto.StatisticsDetailDto">
|
|
select count(1) value,date_format(create_time,'%Y-%m-%d') statistics_str
|
|
from project_info t1 where create_time <![CDATA[ >= ]]> DATE_SUB(CURDATE(), INTERVAL ${day} DAY)
|
|
${authSql}
|
|
group by date_format(create_time,'%Y-%m-%d')
|
|
|
|
|
|
</select>
|
|
|
|
<insert id="insertProjectInfo" parameterType="ProjectInfo" useGeneratedKeys="true" keyProperty="id">
|
|
insert into project_info
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="projectCode != null">project_code,</if>
|
|
<if test="projectName != null">project_name,</if>
|
|
<if test="poc != null">poc,</if>
|
|
<if test="customerCode != null">customer_code,</if>
|
|
<if test="customerName != null">customer_name,</if>
|
|
<if test="customerUserName != null">customer_user_name,</if>
|
|
<if test="customerPhone != null">customer_phone,</if>
|
|
<if test="h3cPerson != null">h3c_person,</if>
|
|
<if test="h3cPhone != null">h3c_phone,</if>
|
|
<if test="industryType != null">industry_type,</if>
|
|
<if test="bgProperty != null">bg_property,</if>
|
|
<if test="agentCode != null">agent_code,</if>
|
|
<if test="projectStage != null">project_stage,</if>
|
|
<if test="projectGraspDegree != null">project_grasp_degree,</if>
|
|
<if test="hzSupportUser != null">hz_support_user,</if>
|
|
<if test="operateInstitution != null">operate_institution,</if>
|
|
<if test="partnerCode != null">partner_code,</if>
|
|
<if test="partnerName != null">partner_name,</if>
|
|
<if test="partnerUserName != null">partner_user_name,</if>
|
|
<if test="partnerEmail != null">partner_email,</if>
|
|
<if test="contactWay != null">contact_way,</if>
|
|
<if test="estimatedAmount != null">estimated_amount,</if>
|
|
<if test="currencyType != null">currency_type,</if>
|
|
<if test="estimatedOrderTime != null">estimated_order_time,</if>
|
|
<if test="estimatedDeliverTime != null">estimated_deliver_time,</if>
|
|
<if test="competitor != null">competitor,</if>
|
|
<if test="countryProduct != null">country_product,</if>
|
|
<if test="serverConfiguration != null">server_configuration,</if>
|
|
<if test="keyProblem != null">key_problem,</if>
|
|
<if test="projectDesc != null">project_desc,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="projectCode != null">#{projectCode},</if>
|
|
<if test="projectName != null">#{projectName},</if>
|
|
<if test="poc != null">#{poc},</if>
|
|
<if test="customerCode != null">#{customerCode},</if>
|
|
<if test="customerName != null">#{customerName},</if>
|
|
<if test="customerUserName != null">#{customerUserName},</if>
|
|
<if test="customerPhone != null">#{customerPhone},</if>
|
|
<if test="h3cPerson != null">#{h3cPerson},</if>
|
|
<if test="h3cPhone != null">#{h3cPhone},</if>
|
|
<if test="industryType != null">#{industryType},</if>
|
|
<if test="bgProperty != null">#{bgProperty},</if>
|
|
<if test="agentCode != null">#{agentCode},</if>
|
|
<if test="projectStage != null">#{projectStage},</if>
|
|
<if test="projectGraspDegree != null">#{projectGraspDegree},</if>
|
|
<if test="hzSupportUser != null">#{hzSupportUser},</if>
|
|
<if test="operateInstitution != null">#{operateInstitution},</if>
|
|
<if test="partnerCode != null">#{partnerCode},</if>
|
|
<if test="partnerName != null">#{partnerName},</if>
|
|
<if test="partnerUserName != null">#{partnerUserName},</if>
|
|
<if test="partnerEmail != null">#{partnerEmail},</if>
|
|
<if test="contactWay != null">#{contactWay},</if>
|
|
<if test="estimatedAmount != null">#{estimatedAmount},</if>
|
|
<if test="currencyType != null">#{currencyType},</if>
|
|
<if test="estimatedOrderTime != null">#{estimatedOrderTime},</if>
|
|
<if test="estimatedDeliverTime != null">#{estimatedDeliverTime},</if>
|
|
<if test="competitor != null">#{competitor},</if>
|
|
<if test="countryProduct != null">#{countryProduct},</if>
|
|
<if test="serverConfiguration != null">#{serverConfiguration},</if>
|
|
<if test="keyProblem != null">#{keyProblem},</if>
|
|
<if test="projectDesc != null">#{projectDesc},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
<update id="updateCustomerCodeByCode">
|
|
update project_info set customer_code = #{newValue} where customer_code = #{oldValue}
|
|
</update>
|
|
<update id="updateProjectInfo" parameterType="ProjectInfo">
|
|
update project_info
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="projectCode != null">project_code = #{projectCode},</if>
|
|
<if test="projectName != null">project_name = #{projectName},</if>
|
|
<if test="poc != null">poc = #{poc},</if>
|
|
<if test="customerCode != null">customer_code = #{customerCode},</if>
|
|
<if test="customerName != null">customer_name = #{customerName},</if>
|
|
<if test="customerUserName != null">customer_user_name=#{customerUserName},</if>
|
|
<if test="customerPhone != null">customer_phone=#{customerPhone},</if>
|
|
<if test="h3cPhone != null">h3c_phone=#{h3cPhone},</if>
|
|
<if test="h3cPerson != null">h3c_person=#{h3cPerson},</if>
|
|
<if test="bgProperty != null">bg_property=#{bgProperty},</if>
|
|
<if test="industryType != null">industry_type = #{industryType},</if>
|
|
<if test="agentCode != null">agent_code = #{agentCode},</if>
|
|
<if test="projectStage != null">project_stage = #{projectStage},</if>
|
|
<if test="projectGraspDegree != null">project_grasp_degree = #{projectGraspDegree},</if>
|
|
<if test="hzSupportUser != null">hz_support_user = #{hzSupportUser},</if>
|
|
<if test="operateInstitution != null">operate_institution = #{operateInstitution},</if>
|
|
partner_code = #{partnerCode},
|
|
<if test="partnerName != null">partner_name = #{partnerName},</if>
|
|
<if test="partnerUserName != null">partner_user_name = #{partnerUserName},</if>
|
|
<if test="partnerEmail != null">partner_email=#{partnerEmail},</if>
|
|
<if test="contactWay != null">contact_way = #{contactWay},</if>
|
|
<if test="estimatedAmount != null">estimated_amount = #{estimatedAmount},</if>
|
|
<if test="currencyType != null">currency_type = #{currencyType},</if>
|
|
<if test="estimatedOrderTime != null">estimated_order_time = #{estimatedOrderTime},</if>
|
|
<if test="estimatedDeliverTime != null">estimated_deliver_time = #{estimatedDeliverTime},</if>
|
|
<if test="competitor != null">competitor = #{competitor},</if>
|
|
<if test="countryProduct != null">country_product = #{countryProduct},</if>
|
|
<if test="serverConfiguration != null">server_configuration = #{serverConfiguration},</if>
|
|
<if test="keyProblem != null">key_problem = #{keyProblem},</if>
|
|
<if test="projectDesc != null">project_desc = #{projectDesc},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
<update id="updateOrderTimeById">
|
|
update project_info
|
|
set estimated_order_time = now()
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteProjectInfoById" parameterType="Long">
|
|
delete from project_info where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteProjectInfoByIds" parameterType="String">
|
|
delete from project_info where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
</mapper> |