解决商品的bug
This commit is contained in:
@@ -1,20 +1,31 @@
|
||||
<?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.jsh.erp.datasource.mappers.MaterialMapper">
|
||||
<resultMap extends="BaseResultMap" id="ResultMapList" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
|
||||
<result column="unitName" jdbcType="VARCHAR" property="unitName" />
|
||||
<result column="categoryName" jdbcType="VARCHAR" property="categoryName" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap extends="BaseResultMap" id="ResultAndUnitMap" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
|
||||
<result column="UName" jdbcType="VARCHAR" property="unitName" />
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByConditionMaterial" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="BaseResultMap">
|
||||
select *
|
||||
FROM jsh_material
|
||||
<select id="selectByConditionMaterial" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultMapList">
|
||||
select m.*,u.uname unitName, mc.name categoryName
|
||||
FROM jsh_material m
|
||||
left JOIN jsh_unit u on m.UnitId = u.id
|
||||
left JOIN jsh_materialcategory mc on m.CategoryId = mc.id
|
||||
where 1=1
|
||||
<if test="name != null">
|
||||
and name like '%${name}%'
|
||||
and m.name like '%${name}%'
|
||||
</if>
|
||||
<if test="model != null">
|
||||
and model like '%${model}%'
|
||||
and m.model like '%${model}%'
|
||||
</if>
|
||||
<if test="categoryId != 1">
|
||||
and m.CategoryId in (${categoryIds})
|
||||
</if>
|
||||
order by m.id asc
|
||||
<if test="offset != null and rows != null">
|
||||
limit #{offset},#{rows}
|
||||
</if>
|
||||
@@ -22,14 +33,19 @@
|
||||
|
||||
<select id="countsByMaterial" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(id)
|
||||
FROM jsh_material
|
||||
COUNT(m.id)
|
||||
FROM jsh_material m
|
||||
left JOIN jsh_unit u on m.UnitId = u.id
|
||||
left JOIN jsh_materialcategory mc on m.CategoryId = mc.id
|
||||
WHERE 1=1
|
||||
<if test="name != null">
|
||||
and name like '%${name}%'
|
||||
and m.name like '%${name}%'
|
||||
</if>
|
||||
<if test="model != null">
|
||||
and model like '%${model}%'
|
||||
and m.model like '%${model}%'
|
||||
</if>
|
||||
<if test="categoryId != 1">
|
||||
and m.CategoryId in (${categoryIds})
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user