Files
zentao/src/main/resources/mapper/ZtComputerSourceMapper.xml

72 lines
3.4 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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.sa.zentao.mapper.ZtComputerSourceMapper">
<resultMap id="BaseResultMap" type="com.sa.zentao.entity.ZtComputerSource">
<result column="id" property="id" />
<result column="source_type" property="sourceType" />
<result column="inner_ip" property="innerIp" />
<result column="bread" property="bread" />
<result column="cpu_core" property="cpuCore" />
<result column="memory" property="memory" />
<result column="disk" property="disk" />
<result column="system_type" property="systemType" />
<result column="purpose" property="purpose" />
<result column="server_name" property="serverName" />
<result column="house" property="house" />
<result column="id_no" property="idNo" />
<result column="address" property="address" />
<result column="buy_date" property="buyDate" />
<result column="status" property="status" />
<result column="create_user" property="createUser" />
<result column="create_date" property="createDate" />
<result column="update_user" property="updateUser" />
<result column="update_date" property="updateDate" />
</resultMap>
<select id="pageList" resultType="com.sa.zentao.dao.ZtComputerSourceDTO">
SELECT * from zt_computer_source WHERE 1=1
<if test="qo.yearSearch != null and qo.yearSearch != ''">
-- 1年内、3年内、3~5年、5~7年7年以上
<if test="qo.yearSearch == 1">
and DATE_ADD(buy_date, INTERVAL 1 YEAR) <![CDATA[>=]]> now()
</if>
<if test="qo.yearSearch == 2">
and DATE_ADD(buy_date, INTERVAL 3 YEAR) <![CDATA[>]]> now()
</if>
<if test="qo.yearSearch == 3">
and DATE_ADD(buy_date, INTERVAL 3 YEAR) <![CDATA[<]]> now()
and DATE_ADD(buy_date, INTERVAL 5 YEAR) <![CDATA[>]]> now()
</if>
<if test="qo.yearSearch == 4">
and DATE_ADD(buy_date, INTERVAL 5 YEAR) <![CDATA[<]]> now()
and DATE_ADD(buy_date, INTERVAL 7 YEAR) <![CDATA[>]]> now()
</if>
<if test="qo.yearSearch == 5">
and DATE_ADD(buy_date, INTERVAL 7 YEAR) <![CDATA[<]]> now()
</if>
</if>
<if test=" qo.sourceType != null and qo.sourceType != ''">
and source_type = #{qo.sourceType}
</if>
<if test=" qo.systemType != null and qo.systemType != ''">
and system_type = #{qo.systemType}
</if>
<if test=" qo.idNo != null and qo.idNo != ''">
and id_no = #{qo.idNo}
</if>
<if test=" qo.status != null and qo.status != ''">
and status = #{qo.status}
</if>
<if test=" qo.house != null and qo.house != ''">
and house = #{qo.house}
</if>
<if test="qo.useEnv != null and qo.useEnv != ''">
and use_env = #{qo.useEnv}
</if>
order by
CASE WHEN expire_date IS NOT NULL AND expire_date <![CDATA[<]]> NOW() THEN 0 ELSE 1 END ASC,
id desc
</select>
</mapper>