Browse Source

多条件统计

master
xyiege 3 years ago
parent
commit
ad0272cc6d
  1. 2
      src/main/java/cn/chjyj/szwh/controller/admin/AdminAccountCloseController.java
  2. 7
      src/main/java/cn/chjyj/szwh/mapper/UserAccountBillMapper.java
  3. 37
      src/main/resources/mapper/szwh/UserAccountBillMapper.xml

2
src/main/java/cn/chjyj/szwh/controller/admin/AdminAccountCloseController.java

@ -157,6 +157,8 @@ public class AdminAccountCloseController extends BaseController {
}else{ }else{
batchcode = batchcode.replaceAll("\\s*|\r|\n|\t",""); batchcode = batchcode.replaceAll("\\s*|\r|\n|\t","");
} }
// 结算状态 [来自 order ]
String sstatus = request.getString("close_status");
// //
Map rmap = accountCloseService.getBillDetail(uesrIsli,batchcode,ipage,ilimit); Map rmap = accountCloseService.getBillDetail(uesrIsli,batchcode,ipage,ilimit);
jsonObject.put("data",rmap); jsonObject.put("data",rmap);

7
src/main/java/cn/chjyj/szwh/mapper/UserAccountBillMapper.java

@ -39,6 +39,13 @@ public interface UserAccountBillMapper {
*/ */
int countUserAccBill(String userisli); int countUserAccBill(String userisli);
/**
* map统计符合数量
* @param map
* @return
*/
int countUserAccBillMap(@Param("map") Map map);
/** /**
* add new user bill * add new user bill
* @param userAccountBill * @param userAccountBill

37
src/main/resources/mapper/szwh/UserAccountBillMapper.xml

@ -25,20 +25,51 @@
<!-- 多条件查询记录 --> <!-- 多条件查询记录 -->
<select id="getUserAccBillMap" resultType="cn.chjyj.szwh.bean.UserAccountBill"> <select id="getUserAccBillMap" resultType="cn.chjyj.szwh.bean.UserAccountBill">
SELECT <include refid="column"/> SELECT <include refid="column"/>
FROM <include refid="tbName"/> FROM `order` o
LEFT JOIN <include refid="tbName"/> ub ON o.batchcode = ub.batchcode
WHERE o.close_status=1 and ub.batchcode='1683254243765693'
<where> <where>
<if test="map!=null"> <if test="map!=null">
<foreach collection="map" item="v" index="k" separator="and"> <foreach collection="map" item="v" index="k" separator="and">
<if test="v != null and v != ''"> <if test="v != null and v != '' and k!='bcin'">
${k} = #{v} ${k} = #{v}
</if> </if>
<!-- 订单编号 -->
<if test="k=='bcin' and v!=null">
ub.batchcode in
<foreach item="btcode" index="index" collection="v" open="(" separator="," close=")">
#{btcode}
</foreach>
</if>
</foreach> </foreach>
</if> </if>
</where> </where>
ORDER BY id DESC ORDER BY ub.id DESC
LIMIT #{startrs},#{limit} LIMIT #{startrs},#{limit}
</select> </select>
<!-- 多条件统计 -->
<select id="countUserAccBillMap" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*) FROM `order` o
LEFT JOIN <include refid="tbName"/> ub ON o.batchcode = ub.batchcode
<where>
<if test="map!=null">
<foreach collection="map" item="v" index="k" separator="and">
<if test="v != null and v != '' and k!='bcin'">
${k} = #{v}
</if>
<!-- 订单编号 -->
<if test="k=='bcin' and v!=null">
ub.batchcode in
<foreach item="btcode" index="index" collection="v" open="(" separator="," close=")">
#{btcode}
</foreach>
</if>
</foreach>
</if>
</where>
</select>
<!-- 统计数量 --> <!-- 统计数量 -->
<select id="countUserAccBill" parameterType="java.lang.String" resultType="java.lang.Integer"> <select id="countUserAccBill" parameterType="java.lang.String" resultType="java.lang.Integer">
select count(*) from <include refid="tbName"/> where user_isli=#{userisli} select count(*) from <include refid="tbName"/> where user_isli=#{userisli}

Loading…
Cancel
Save