|
@@ -7,6 +7,7 @@
|
|
|
<resultMap type="com.bosshand.virgo.api.workark.model.Product" id="result">
|
|
|
<id column="id" property="id"/>
|
|
|
<result column="organizationId" property="organizationId"/>
|
|
|
+ <result column="organizationName" property="organizationName"/>
|
|
|
<result column="state" property="state"/>
|
|
|
<result column="type" property="type"/>
|
|
|
<result column="productLevelId" property="productLevelId"/>
|
|
@@ -22,33 +23,37 @@
|
|
|
<result column="subtitle" property="subtitle"/>
|
|
|
<result column="customerId" property="customerId"/>
|
|
|
</resultMap>
|
|
|
+
|
|
|
+ <sql id="query">
|
|
|
+ select a.*, b.name as organizationName from workark_product a left join mgr_organization b on a.organizationId = b.id
|
|
|
+ </sql>
|
|
|
|
|
|
<select id="get" resultMap="result">
|
|
|
- select * from workark_product where id = #{id}
|
|
|
+ <include refid="query"/> where a.id = #{id}
|
|
|
</select>
|
|
|
|
|
|
<select id="getList" resultMap="result">
|
|
|
- select * from workark_product
|
|
|
+ <include refid="query"/>
|
|
|
<where>
|
|
|
<if test="organizationId != 0">
|
|
|
- and organizationId = #{organizationId}
|
|
|
+ and a.organizationId = #{organizationId}
|
|
|
</if>
|
|
|
<if test="name != null">
|
|
|
- and name = #{name}
|
|
|
+ and a.name = #{name}
|
|
|
</if>
|
|
|
<if test="state != null">
|
|
|
- and state = #{state}
|
|
|
+ and a.state = #{state}
|
|
|
</if>
|
|
|
<if test="type != null">
|
|
|
- and type = #{type}
|
|
|
+ and a.type = #{type}
|
|
|
</if>
|
|
|
<if test="productLevelId != 0">
|
|
|
- and productLevelId = #{productLevelId}
|
|
|
+ and a.productLevelId = #{productLevelId}
|
|
|
</if>
|
|
|
<if test="customerId != null">
|
|
|
- and customerId = #{customerId}
|
|
|
+ and a.customerId = #{customerId}
|
|
|
</if>
|
|
|
- and deleteState != 1
|
|
|
+ and a.deleteState != 1
|
|
|
</where>
|
|
|
</select>
|
|
|
|
|
@@ -78,29 +83,29 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getLimit" resultMap="result">
|
|
|
- select * from workark_product
|
|
|
+ <include refid="query"/>
|
|
|
<where>
|
|
|
<if test="p.organizationId != 0">
|
|
|
- and organizationId = #{p.organizationId}
|
|
|
+ and a.organizationId = #{p.organizationId}
|
|
|
</if>
|
|
|
<if test="p.name != null">
|
|
|
- and name = #{p.name}
|
|
|
+ and a.name = #{p.name}
|
|
|
</if>
|
|
|
<if test="p.state != null">
|
|
|
- and state = #{p.state}
|
|
|
+ and a.state = #{p.state}
|
|
|
</if>
|
|
|
<if test="p.type != null">
|
|
|
- and type = #{p.type}
|
|
|
+ and a.type = #{p.type}
|
|
|
</if>
|
|
|
<if test="p.productLevelId != 0">
|
|
|
- and productLevelId = #{p.productLevelId}
|
|
|
+ and a.productLevelId = #{p.productLevelId}
|
|
|
</if>
|
|
|
<if test="p.customerId != null">
|
|
|
- and customerId = #{p.customerId}
|
|
|
+ and a.customerId = #{p.customerId}
|
|
|
</if>
|
|
|
- and deleteState != 1
|
|
|
+ and a.deleteState != 1
|
|
|
</where>
|
|
|
- order by createTime desc limit #{currIndex} , #{pageSize}
|
|
|
+ order by a.createTime desc limit #{currIndex} , #{pageSize}
|
|
|
</select>
|
|
|
|
|
|
<insert id="save" useGeneratedKeys="true" keyProperty="id">
|