日期和sql优化
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user