Commit a2f9b326 authored by H2T's avatar H2T

查询bug修改

parent 84c9229b
......@@ -74,8 +74,8 @@
FROM
p_input_item a
where a.is_delete = '0' and a.input_type!='1'
<if test="name!=null"> and a.name like concat(concat('%',#{name}),'%')</if>
<if test="itemNo!=null"> and a.item_no like concat(concat('%',#{itemNo}),'%')</if>
<if test="name!=null"> and a.name like concat('%',#{name}::text,'%')</if>
<if test="itemNo!=null"> and a.item_no like concat('%',#{itemNo}::text,'%')</if>
<if test="isScore!=null"> and a.is_Score = #{isScore}</if>
<if test="itemType!=null"> and a.item_Type = #{itemType} </if>
<!-- <if test="level!=null"> and a.level = #{level} </if> -->
......@@ -108,8 +108,8 @@
p_input_item a left join p_catalog_tree b on a.catalog_id = b.id
where a.is_delete = '0'
and a.input_type!='1'
<if test="name!=null"> and a.name like concat(concat('%',#{name}),'%')</if>
<if test="itemNo!=null"> and a.item_no like concat(concat('%',#{itemNo}),'%')</if>
<if test="name!=null"> and a.name like concat('%',#{name}::text,'%')</if>
<if test="itemNo!=null"> and a.item_no like concat('%',#{itemNo}::text,'%')</if>
<if test="isScore!=null"> and a.is_Score = #{isScore}</if>
<if test="itemType!=null"> and a.item_Type = #{itemType} </if>
<!-- <if test="level!=null"> and a.level = #{level} </if> -->
......@@ -151,7 +151,7 @@
SELECT * FROM p_input_item
where is_delete = '0' and input_type = 0
<if test="id!=null and id !='' ">
and id like concat('%', #{id}, '%')
and id like concat('%', #{id}::text, '%')
</if>
<if test="orgCode!=null and orgCode !='' ">
and org_Code = #{orgCode}
......@@ -163,7 +163,7 @@
and input_classify = #{inputClassify}
</if>
<if test="nameOrItemNo!=null and nameOrItemNo !='' ">
and (name like concat('%', #{nameOrItemNo}, '%') or item_no like concat('%', #{nameOrItemNo}, '%'))
and (name like concat('%', #{nameOrItemNo}::text, '%') or item_no like concat('%', #{nameOrItemNo}::text, '%'))
</if>
<if test="equipmentType!=null and equipmentType.size()>0">
and equipment_type in
......@@ -180,7 +180,7 @@
and custom_type is not null
</if>
<if test="bizOrgCode!=null and bizOrgCode !=''">
and biz_org_code LIKE CONCAT (#{bizOrgCode},'%')
and biz_org_code LIKE CONCAT (#{bizOrgCode}::text,'%')
</if>
ORDER BY create_date DESC
</select>
......@@ -241,8 +241,8 @@
FROM
p_input_item a
where a.is_delete = '0' and a.input_type!='1'
<if test="name!=null"> and a.name like concat(concat('%',#{name}),'%')</if>
<if test="itemNo!=null"> and a.item_no like concat(concat('%',#{itemNo}),'%')</if>
<if test="name!=null"> and a.name like concat('%',#{name}::text,'%')</if>
<if test="itemNo!=null"> and a.item_no like concat('%',#{itemNo}::text,'%')</if>
<if test="isScore!=null"> and a.is_Score = #{isScore}</if>
<if test="itemType!=null"> and a.item_Type = #{itemType} </if>
<if test="orgCode!=null"> and a.org_Code = #{orgCode}</if>
......@@ -250,7 +250,7 @@
and a.catalog_id in <foreach collection="catalogIds" item="catalogId" index="index" open="(" separator="," close=")" >#{catalogId}</foreach>
</if>
<if test="bizOrgCode!=null and bizOrgCode!=''">
and a.biz_org_code LIKE CONCAT (#{bizOrgCode} ,'%')
and a.biz_org_code LIKE CONCAT (#{bizOrgCode}::text,'%')
</if>
<if test="treeId != null and treeId != '' and treeId == '-1'">
and a.facilities_type is not null
......@@ -322,8 +322,8 @@
p_input_item a left join p_catalog_tree b on a.catalog_id = b.id
where a.is_delete = '0'
and a.input_type!='1'
<if test="name!=null"> and a.name like concat(concat('%',#{name}),'%')</if>
<if test="itemNo!=null"> and a.item_no like concat(concat('%',#{itemNo}),'%')</if>
<if test="name!=null"> and a.name like concat('%',#{name}::text,'%')</if>
<if test="itemNo!=null"> and a.item_no like concat('%',#{itemNo}::text,'%')</if>
<if test="isScore!=null"> and a.is_Score = #{isScore}</if>
<if test="itemType!=null"> and a.item_Type = #{itemType} </if>
<if test="orgCode!=null"> and a.org_Code = #{orgCode}</if>
......@@ -331,7 +331,7 @@
and a.catalog_id in <foreach collection="catalogIds" item="catalogId" index="index" open="(" separator="," close=")" >#{catalogId}</foreach>
</if>
<if test="bizOrgCode!=null and bizOrgCode!=''">
and a.biz_org_code LIKE CONCAT (#{bizOrgCode},'%')
and a.biz_org_code LIKE CONCAT (#{bizOrgCode}::text,'%')
</if>
<if test="treeId != null and treeId != '' and treeId == '-1'">
and a.facilities_type is not null
......@@ -421,8 +421,8 @@
p_input_item a left join p_catalog_tree b on a.catalog_id = b.id
where a.is_delete = '0'
and a.input_type!='1'
<if test="name!=null"> and a.name like concat(concat('%',#{name}),'%')</if>
<if test="itemNo!=null"> and a.item_no like concat(concat('%',#{itemNo}),'%')</if>
<if test="name!=null"> and a.name like concat('%',#{name}::text,'%')</if>
<if test="itemNo!=null"> and a.item_no like concat('%',#{itemNo}::text,'%')</if>
<if test="isScore!=null"> and a.is_Score = #{isScore}</if>
<if test="itemType!=null"> and a.item_Type = #{itemType} </if>
<if test="orgCode!=null"> and a.org_Code = #{orgCode}</if>
......@@ -430,7 +430,7 @@
and a.catalog_id in <foreach collection="catalogIds" item="catalogId" index="index" open="(" separator="," close=")" >#{catalogId}</foreach>
</if>
<if test="bizOrgCode!=null and bizOrgCode!=''">
and a.biz_org_code LIKE CONCAT (#{bizOrgCode},'%')
and a.biz_org_code LIKE CONCAT (#{bizOrgCode}::text,'%')
</if>
<if test="treeId != null and treeId != '' and treeId == '-1'">
and a.facilities_type is not null
......
......@@ -121,10 +121,10 @@
<where>
is_delete = 0
<if test="pointNo != null and pointNo != ''">
and point_no LIKE CONCAT ('%',#{pointNo},'%')
and point_no LIKE CONCAT ('%',#{pointNo}::text,'%')
</if>
<if test="name != null and name != ''">
and name LIKE CONCAT ('%',#{name},'%')
and name LIKE CONCAT ('%',#{name}::text,'%')
</if>
<if test="isFixed != null and isFixed != ''">
and is_fixed = #{isFixed}
......@@ -134,7 +134,7 @@
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
and biz_org_code LIKE CONCAT (#{bizOrgCode} ,'%')
and biz_org_code LIKE CONCAT (#{bizOrgCode}::text ,'%')
</if>
</where>
</select>
......@@ -203,12 +203,12 @@
)</if>
AND p.is_delete = 0
and ( select COUNT(p_point_inputitem.id) fROM p_point_inputitem where p_point_inputitem.point_id =p.id) >0
<if test="name!=null"> AND ( p.point_no LIKE CONCAT('%', #{name},'%')
OR p.NAME LIKE CONCAT('%', #{name},'%')) </if>
<if test="name!=null"> AND ( p.point_no LIKE CONCAT('%', #{name}::text,'%')
OR p.NAME LIKE CONCAT('%', #{name}::text,'%')) </if>
<if test="query != null and query != ''">
<choose>
<when test="queryType != null and (queryType == 'point' || queryType == 'all') ">
AND CONCAT(p. NAME, ',', p.point_no ) LIKE concat('%', #{query}, '%')
AND CONCAT(p. NAME, ',', p.point_no ) LIKE concat('%', #{query}::text, '%')
</when>
<otherwise>
AND EXISTS (
......@@ -220,20 +220,20 @@
WHERE
p.id = pi.point_id
<if test="queryType == null or queryType == '' or queryType == 'all' ">
AND CONCAT( ii. NAME, ',', p. NAME, ',', p.point_no ) LIKE concat('%', #{query}, '%')
AND CONCAT( ii. NAME, ',', p. NAME, ',', p.point_no ) LIKE concat('%', #{query}::text, '%')
</if>
<if test="queryType != null and queryType == 'inputItem' ">
AND ii. NAME LIKE concat('%', #{query}, '%')
AND ii. NAME LIKE concat('%', #{query}::text, '%')
</if>
<if test="queryType != null and queryType == 'point' ">
AND CONCAT(p. NAME, ',', p.point_no ) LIKE concat('%', #{query}, '%')
AND CONCAT(p. NAME, ',', p.point_no ) LIKE concat('%', #{query}::text, '%')
</if>
)
</otherwise>
</choose>
</if>
<!-- <if test="orgCode!=null "> and p.org_Code= #{orgCode} </if>-->
<if test="orgCode!=null "> and p.biz_org_code LIKE CONCAT (#{orgCode} ,'%') </if>
<if test="orgCode!=null "> and p.biz_org_code LIKE CONCAT (#{orgCode}::text ,'%') </if>
</where>
......@@ -261,14 +261,14 @@
AND p.is_delete = 0
and ( select COUNT(p_point_inputitem.id) fROM p_point_inputitem where p_point_inputitem.point_id =p.id) >0
<if test="name!=null"> AND ( p.point_no LIKE CONCAT('%', #{name},'%')
OR p.NAME LIKE CONCAT('%', #{name},'%')) </if>
<if test="name!=null"> AND ( p.point_no LIKE CONCAT('%', #{name}::text,'%')
OR p.NAME LIKE CONCAT('%', #{name}::text,'%')) </if>
<if test="query != null and query != ''">
<choose>
<when test="queryType != null and (queryType == 'point'|| queryType == 'all')">
AND CONCAT(p. NAME, ',', p.point_no ) LIKE concat('%', #{query}, '%')
AND CONCAT(p. NAME, ',', p.point_no ) LIKE concat('%', #{query}::text, '%')
</when>
<otherwise>
AND EXISTS (
......@@ -280,13 +280,13 @@
WHERE
p.id = pi.point_id
<if test="queryType == null or queryType == '' or queryType == 'all' ">
AND CONCAT( ii. NAME, ',', p. NAME, ',', p.point_no ) LIKE concat('%', #{query}, '%')
AND CONCAT( ii. NAME, ',', p. NAME, ',', p.point_no ) LIKE concat('%', #{query}::text, '%')
</if>
<if test="queryType != null and queryType == 'inputItem' ">
AND ii. NAME LIKE concat('%', #{query}, '%')
AND ii. NAME LIKE concat('%', #{query}::text, '%')
</if>
<if test="queryType != null and queryType == 'point' ">
AND CONCAT(p. NAME, ',', p.point_no ) LIKE concat('%', #{query}, '%')
AND CONCAT(p. NAME, ',', p.point_no ) LIKE concat('%', #{query}::text, '%')
</if>
)
</otherwise>
......@@ -317,7 +317,7 @@
</if>
<!-- <if test="orgCode!=null "> and p.org_Code= #{orgCode} </if>-->
<if test="orgCode!=null "> and p.biz_org_code LIKE CONCAT (#{orgCode} ,'%') </if>
<if test="orgCode!=null "> and p.biz_org_code LIKE CONCAT (#{orgCode}::text ,'%') </if>
</where>
limit #{offset},#{pageSize};
......@@ -486,7 +486,7 @@
(select status ,id FROM p_point
where is_delete = 0
<if test="orgCode!=null">
and (org_code LIKE CONCAT( #{orgCode}, '-%' ) or org_code= #{orgCode} )
and (org_code LIKE CONCAT( #{orgCode}::text, '-%' ) or org_code= #{orgCode} )
</if>
) vp
) tt group by tt.RealTimeStatus,tt.status order by status
......@@ -503,7 +503,7 @@
WHERE
check_time LIKE CONCAT( DATE_FORMAT( now( ), '%Y-%m-%d' ), '%' )
<if test="orgCode!=null">
and (org_code LIKE CONCAT('%',#{orgCode},'%' ))
and (org_code LIKE CONCAT('%',#{orgCode}::text,'%' ))
</if>
AND is_ok = 1
) AS over_num,
......@@ -515,7 +515,7 @@
WHERE
check_time LIKE CONCAT( DATE_FORMAT( now( ), '%Y-%m-%d' ), '%' )
<if test="orgCode!=null">
and (org_code LIKE CONCAT('%',#{orgCode},'%' ))
and (org_code LIKE CONCAT('%',#{orgCode}::text,'%' ))
</if>
AND is_ok = 2
) AS unfinish_num,
......@@ -527,7 +527,7 @@
WHERE
check_time LIKE CONCAT( DATE_FORMAT( now( ), '%Y-%m-%d' ), '%' )
<if test="orgCode!=null">
and (org_code LIKE CONCAT('%',#{orgCode},'%' ))
and (org_code LIKE CONCAT('%',#{orgCode}::text,'%' ))
</if>
AND is_ok = 3
) AS miss_num,
......@@ -539,7 +539,7 @@
WHERE
( p_plan_task.check_date LIKE concat( curdate( ), '%' ) )
<if test="orgCode!=null">
and (org_code LIKE CONCAT('%',#{orgCode},'%' ))
and (org_code LIKE CONCAT('%',#{orgCode}::text,'%' ))
</if>
) AS today_num
</select>
......@@ -559,7 +559,7 @@
(select DISTINCT is_ok as realTimeStatus ,point_id FROM p_check
<where>
<if test="orgCode!=null">
and (org_code LIKE CONCAT( #{orgCode}, '-%' ) or org_code= #{orgCode} )
and (org_code LIKE CONCAT( #{orgCode}::text, '-%' ) or org_code= #{orgCode} )
</if>
</where>
) vp
......@@ -585,7 +585,7 @@
(select status ,id FROM p_point
where is_delete = 0
<if test="orgCode!=null">
and biz_org_code LIKE CONCAT( #{orgCode}, '%' )
and biz_org_code LIKE CONCAT( #{orgCode}::text, '%' )
</if>
) vp
) tt group by tt.RealTimeStatus,tt.status order by status
......
......@@ -117,13 +117,13 @@
p_route r
WHERE
r.is_delete = 0
<if test="id!=null">AND r.id LIKE CONCAT('%', #{id}, '%')</if>
<if test="name!=null">AND r.name LIKE CONCAT('%', #{name}, '%')</if>
<if test="remark!=null">AND r.remark LIKE CONCAT('%', #{remark}, '%')</if>
<if test="id!=null">AND r.id LIKE CONCAT('%', #{id}::text, '%')</if>
<if test="name!=null">AND r.name LIKE CONCAT('%', #{name}::text, '%')</if>
<if test="remark!=null">AND r.remark LIKE CONCAT('%', #{remark}::text, '%')</if>
<if test="orgCode!=null">AND r.org_Code = #{orgCode}</if>
<if test="enterpriseType!=null">AND r.enterprise_type = #{enterpriseType}</if>
<if test="equipType!=null">AND r.equip_type = #{equipType}</if>
<if test="bizOrgCode!=null">AND r.biz_org_code LIKE CONCAT( #{bizOrgCode}, '%') </if>
<if test="bizOrgCode!=null">AND r.biz_org_code LIKE CONCAT( #{bizOrgCode}::text, '%') </if>
<choose>
<when test="deptId > 0 " > AND r.dept_id = #{deptId}</when>
<when test="deptId == -1 " > AND r.dept_id in(0,-1)</when>
......@@ -196,7 +196,7 @@
LEFT JOIN p_route r ON r.id = ppl.route_id
WHERE
r.is_delete = 0
AND find_in_set(#{userId}, ppl.user_id) > 0 and r.biz_org_code LIKE CONCAT( #{orgCode}, '%')
AND find_in_set(#{userId}, ppl.user_id) > 0 and r.biz_org_code LIKE CONCAT( #{orgCode}::text, '%')
</if>
<if test="(orgCode != null and orgCode != '')">
......@@ -211,7 +211,7 @@
WHERE
r.is_delete = 0
<if test="orgCode != null and orgCode != ''">
AND r.biz_org_code LIKE CONCAT( #{orgCode}, '%')
AND r.biz_org_code LIKE CONCAT( #{orgCode}::text, '%')
</if>
</if>) temp
......@@ -266,8 +266,8 @@
where p.is_delete = 0
AND rp.route_id = #{routeId}
AND p.org_code = #{orgCode}
<if test="pointNo != null and pointNo != ''">and p.point_no like CONCAT('%', #{pointNo}, '%')</if>
<if test="name != null and name != ''">and p.name like CONCAT('%', #{name}, '%')</if>
<if test="pointNo != null and pointNo != ''">and p.point_no like CONCAT('%', #{pointNo}::text, '%')</if>
<if test="name != null and name != ''">and p.name like CONCAT('%', #{name}::text, '%')</if>
<choose>
<when test="pageSize==-1"></when>
<when test="pageSize!=-1">limit #{offset},#{pageSize}</when>
......@@ -310,8 +310,8 @@
AND rp.route_id = #{routeId}
AND p.org_code = #{orgCode}
order by rp.order_no
<if test="pointNo != null and pointNo != ''">and p.point_no like CONCAT('%', #{pointNo}, '%')</if>
<if test="name != null and name != ''">and p.name like CONCAT('%', #{name}, '%')</if>
<if test="pointNo != null and pointNo != ''">and p.point_no like CONCAT('%', #{pointNo}::text, '%')</if>
<if test="name != null and name != ''">and p.name like CONCAT('%', #{name}::text, '%')</if>
<choose>
<when test="pageSize==-1"></when>
<when test="pageSize!=-1">limit #{offset},#{pageSize}</when>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment