Commit 99e7db36 authored by 季圣华's avatar 季圣华
Browse files

日期和sql优化

parent f04dcd22
......@@ -26,16 +26,20 @@
where 1=1
and me.default_flag=1
<if test="barCode != null">
and me.bar_code like '%${barCode}%'
<bind name="bindBarCode" value="'%'+barCode+'%'"/>
and me.bar_code like #{bindBarCode}
</if>
<if test="name != null">
and m.name like '%${name}%'
<bind name="bindName" value="'%'+name+'%'"/>
and m.name like #{bindName}
</if>
<if test="standard != null">
and m.standard like '%${standard}%'
<bind name="bindStandard" value="'%'+standard+'%'"/>
and m.standard like #{bindStandard}
</if>
<if test="model != null">
and m.model like '%${model}%'
<bind name="bindModel" value="'%'+model+'%'"/>
and m.model like #{bindModel}
</if>
<if test="idList.size()>0">
and m.category_id in
......@@ -60,16 +64,20 @@
WHERE 1=1
and me.default_flag=1
<if test="barCode != null">
and me.bar_code like '%${barCode}%'
<bind name="bindBarCode" value="'%'+barCode+'%'"/>
and me.bar_code like #{bindBarCode}
</if>
<if test="name != null">
and m.name like '%${name}%'
<bind name="bindName" value="'%'+name+'%'"/>
and m.name like #{bindName}
</if>
<if test="standard != null">
and m.standard like '%${standard}%'
<bind name="bindStandard" value="'%'+standard+'%'"/>
and m.standard like #{bindStandard}
</if>
<if test="model != null">
and m.model like '%${model}%'
<bind name="bindModel" value="'%'+model+'%'"/>
and m.model like #{bindModel}
</if>
<if test="idList.size()>0">
and m.category_id in
......@@ -83,14 +91,14 @@
<select id="findUnitList" resultType="com.jsh.erp.datasource.entities.Unit">
select u.* from jsh_unit u
left join jsh_material m on m.unit_id=u.id and ifnull(m.delete_flag,'0') !='1'
where m.id = ${mId}
where m.id = #{mId}
and ifnull(u.delete_flag,'0') !='1'
</select>
<select id="findById" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
select m.*,u.name unit_name from jsh_material m
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_flag,'0') !='1'
where m.id = ${id}
where m.id = #{id}
and ifnull(m.delete_flag,'0') !='1'
</select>
......@@ -100,7 +108,7 @@
from jsh_material m
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
where me.id = ${meId}
where me.id = #{meId}
and ifnull(m.delete_flag,'0') !='1'
</select>
......@@ -133,7 +141,8 @@
left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
where m.enabled=1 and me.id is not null
<if test="q != null">
and (m.name like '%${q}%' or me.bar_code like '%${q}%')
<bind name="bindKey" value="'%'+q+'%'"/>
and (me.bar_code like #{bindKey} or m.name like #{bindKey} or m.standard like #{bindKey} or m.model like #{bindKey})
</if>
<if test="idList.size()>0">
and m.category_id in
......@@ -154,16 +163,20 @@
where 1=1
and me.default_flag=1
<if test="barCode != null">
and me.bar_code like '%${barCode}%'
<bind name="bindBarCode" value="'%'+barCode+'%'"/>
and me.bar_code like #{bindBarCode}
</if>
<if test="name != null">
and m.name like '%${name}%'
<bind name="bindName" value="'%'+name+'%'"/>
and m.name like #{bindName}
</if>
<if test="standard != null">
and m.standard like '%${standard}%'
<bind name="bindStandard" value="'%'+standard+'%'"/>
and m.standard like #{bindStandard}
</if>
<if test="model != null">
and m.model like '%${model}%'
<bind name="bindModel" value="'%'+standard+'%'"/>
and m.model like #{bindModel}
</if>
<if test="idList.size()>0">
and m.category_id in
......@@ -264,7 +277,7 @@
left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
where 1=1
<if test="meId != null">
and me.id = ${meId}
and me.id = #{meId}
</if>
and ifnull(m.delete_flag,'0') !='1'
</select>
......
......@@ -6,7 +6,8 @@
FROM jsh_material_property
where 1=1
<if test="name != null">
and native_name like '%${name}%'
<bind name="bindName" value="'%'+name+'%'"/>
and native_name like #{bindName}
</if>
and ifnull(delete_flag,'0') !='1'
<if test="offset != null and rows != null">
......@@ -19,7 +20,8 @@
FROM jsh_material_property
WHERE 1=1
<if test="name != null">
and native_name like '%${name}%'
<bind name="bindName" value="'%'+name+'%'"/>
and native_name like #{bindName}
</if>
and ifnull(delete_flag,'0') !='1'
</select>
......
......@@ -7,7 +7,8 @@
WHERE 1=1
and ifnull(delete_Flag,'0') !='1'
<if test="name != null">
and msg_title like '%${name}%'
<bind name="bindName" value="'%'+name+'%'"/>
and msg_title like #{bindName}
</if>
order by create_time desc
<if test="offset != null and rows != null">
......@@ -21,7 +22,8 @@
WHERE 1=1
and ifnull(delete_Flag,'0') !='1'
<if test="name != null">
and msg_title like '%${name}%'
<bind name="bindName" value="'%'+name+'%'"/>
and msg_title like #{bindName}
</if>
</select>
<update id="batchDeleteMsgByIds">
......@@ -54,7 +56,7 @@
WHERE 1=1
and ifnull(delete_Flag,'0') !='1'
<if test="msgTitle != null">
and msg_title = '${msgTitle}'
and msg_title = #{msgTitle}
</if>
</select>
......@@ -65,7 +67,7 @@
WHERE 1=1
and ifnull(delete_Flag,'0') !='1'
<if test="status != null">
and status = '${status}'
and status = #{status}
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -6,10 +6,11 @@
FROM jsh_person
where 1=1
<if test="name != null and name != ''">
and name like '%${name}%'
<bind name="bindName" value="'%'+name+'%'"/>
and name like #{bindName}
</if>
<if test="type != null and type != ''">
and type='${type}'
and type=#{type}
</if>
and ifnull(delete_flag,'0') !='1'
<if test="offset != null and rows != null">
......@@ -22,10 +23,11 @@
FROM jsh_person
WHERE 1=1
<if test="name != null and name != ''">
and name like '%${name}%'
<bind name="bindName" value="'%'+name+'%'"/>
and name like #{bindName}
</if>
<if test="type != null and type != ''">
and type='${type}'
and type=#{type}
</if>
and ifnull(delete_flag,'0') !='1'
</select>
......
......@@ -7,7 +7,8 @@
WHERE 1=1
and ifnull(delete_flag,'0') !='1'
<if test="name != null">
and name like '%${name}%'
<bind name="bindName" value="'%'+name+'%'"/>
and name like #{bindName}
</if>
<if test="offset != null and rows != null">
limit #{offset},#{rows}
......@@ -20,7 +21,8 @@
WHERE 1=1
and ifnull(delete_flag,'0') !='1'
<if test="name != null">
and name like '%${name}%'
<bind name="bindName" value="'%'+name+'%'"/>
and name like #{bindName}
</if>
</select>
<update id="batchDeleteRoleByIds">
......
......@@ -6,16 +6,19 @@
FROM jsh_supplier
where 1=1
<if test="supplier != null and supplier !=''">
and supplier like '%${supplier}%'
<bind name="bindSupplier" value="'%'+supplier+'%'"/>
and supplier like #{bindSupplier}
</if>
<if test="type != null and type !=''">
and type='${type}'
and type=#{type}
</if>
<if test="phonenum != null and phonenum !=''">
and phone_num like '%${phonenum}%'
<bind name="bindPhoneNum" value="'%'+phonenum+'%'"/>
and phone_num like #{bindPhoneNum}
</if>
<if test="telephone != null and telephone !=''">
and telephone like '%${telephone}%'
<bind name="bindTelephone" value="'%'+telephone+'%'"/>
and telephone like #{bindTelephone}
</if>
and ifnull(delete_flag,'0') !='1'
order by id desc
......@@ -29,16 +32,19 @@
FROM jsh_supplier
WHERE 1=1
<if test="supplier != null and supplier !=''">
and supplier like '%${supplier}%'
<bind name="bindSupplier" value="'%'+supplier+'%'"/>
and supplier like #{bindSupplier}
</if>
<if test="type != null and type !=''">
and type='${type}'
and type=#{type}
</if>
<if test="phonenum != null and phonenum !=''">
and phone_num like '%${phonenum}%'
<bind name="bindPhoneNum" value="'%'+phonenum+'%'"/>
and phone_num like #{bindPhoneNum}
</if>
<if test="telephone != null and telephone !=''">
and telephone like '%${telephone}%'
<bind name="bindTelephone" value="'%'+telephone+'%'"/>
and telephone like #{bindTelephone}
</if>
and ifnull(delete_flag,'0') !='1'
</select>
......@@ -48,16 +54,19 @@
FROM jsh_supplier
where 1=1
<if test="supplier != null and supplier !=''">
and supplier like '%${supplier}%'
<bind name="bindSupplier" value="'%'+supplier+'%'"/>
and supplier like #{bindSupplier}
</if>
<if test="type != null and type !=''">
and type='${type}'
and type=#{type}
</if>
<if test="phonenum != null and phonenum !=''">
and phone_num like '%${phonenum}%'
<bind name="bindPhoneNum" value="'%'+phonenum+'%'"/>
and phone_num like #{bindPhoneNum}
</if>
<if test="telephone != null and telephone !=''">
and telephone like '%${telephone}%'
<bind name="bindTelephone" value="'%'+telephone+'%'"/>
and telephone like #{bindTelephone}
</if>
and ifnull(delete_flag,'0') !='1'
order by id desc
......
......@@ -6,7 +6,8 @@
FROM jsh_system_config
where 1=1
<if test="companyName != null">
and company_name like '%${companyName}%'
<bind name="bindCompanyName" value="'%'+companyName+'%'"/>
and company_name like #{bindCompanyName}
</if>
and ifnull(delete_flag,'0') !='1'
<if test="offset != null and rows != null">
......@@ -19,7 +20,8 @@
FROM jsh_system_config
WHERE 1=1
<if test="companyName != null">
and company_name like '%${companyName}%'
<bind name="bindCompanyName" value="'%'+companyName+'%'"/>
and company_name like #{bindCompanyName}
</if>
and ifnull(delete_flag,'0') !='1'
</select>
......
......@@ -10,7 +10,8 @@
FROM jsh_tenant
where 1=1
<if test="loginName != null">
and login_name like '%${loginName}%'
<bind name="bindLoginName" value="'%'+loginName+'%'"/>
and login_name like #{bindLoginName}
</if>
order by id desc
<if test="offset != null and rows != null">
......@@ -23,7 +24,8 @@
FROM jsh_tenant
WHERE 1=1
<if test="loginName != null">
and login_name like '%${loginName}%'
<bind name="bindLoginName" value="'%'+loginName+'%'"/>
and login_name like #{bindLoginName}
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -6,7 +6,8 @@
FROM jsh_unit
where 1=1
<if test="name != null">
and name like '%${name}%'
<bind name="bindName" value="'%'+name+'%'"/>
and name like #{bindName}
</if>
and ifnull(delete_flag,'0') !='1'
<if test="offset != null and rows != null">
......@@ -19,7 +20,8 @@
FROM jsh_unit
WHERE 1=1
<if test="name != null">
and name like '%${name}%'
<bind name="bindName" value="'%'+name+'%'"/>
and name like #{bindName}
</if>
and ifnull(delete_flag,'0') !='1'
</select>
......
......@@ -25,10 +25,12 @@
where 1=1
and ifnull(user.status,'0') not in('1','2')
<if test="userName != null">
and user.username like '%${userName}%'
<bind name="bindUserName" value="'%'+userName+'%'"/>
and user.username like #{bindUserName}
</if>
<if test="loginName != null">
and user.login_name like '%${loginName}%'
<bind name="bindLoginName" value="'%'+loginName+'%'"/>
and user.login_name like #{bindLoginName}
</if>
order by rel.user_blng_orga_dspl_seq,user.id desc
<if test="offset != null and rows != null">
......@@ -41,10 +43,12 @@
where 1=1
and ifnull(user.status,'0') not in('1','2')
<if test="userName != null">
and user.username like '%${userName}%'
<bind name="bindUserName" value="'%'+userName+'%'"/>
and user.username like #{bindUserName}
</if>
<if test="loginName != null">
and user.login_name like '%${loginName}%'
<bind name="bindLoginName" value="'%'+loginName+'%'"/>
and user.login_name like #{bindLoginName}
</if>
</select>
<select id="getUserListByUserNameOrLoginName" resultMap="com.jsh.erp.datasource.mappers.UserMapper.BaseResultMap">
......
Supports Markdown
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