From a27768e7b484cc20bf0dcdb699318ae9725e0dd8 Mon Sep 17 00:00:00 2001 From: Helius <wangdoubleone@gmail.com> Date: Thu, 21 Jan 2021 11:48:08 +0800 Subject: [PATCH] modify --- zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml | 142 ++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 132 insertions(+), 10 deletions(-) diff --git a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml index 8dd31a1..18c9fa7 100644 --- a/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml +++ b/zq-erp/src/main/resources/mybatis/mapper/hive/SysProjUseDao.xml @@ -5,7 +5,12 @@ <mapper namespace="com.matrix.system.hive.dao.SysProjUseDao"> <resultMap type="SysProjUse" id="SysProjUseMap"> + <id property="id" column="ID"/> + <result property="createBy" column="create_by" /> + <result property="createTime" column="create_time" /> + <result property="updateBy" column="update_by" /> + <result property="updateTime" column="update_time" /> <result property="orderItemId" column="ORDER_ITEM_ID"/> <result property="projId" column="PROJ_ID"/> <result property="surplusCount" column="SURPLUS_COUNT"/> @@ -25,17 +30,116 @@ <result property="projName" column="proj_name"/> <result property="deductionNum" column="deductionNum"/> <result property="isCourse" column="is_course"/> - - - - + <result property="timeLength" column="time_length"/> <!-- 对应项目信息--> <association property="projInfo" javaType="ShoppingGoods" resultMap="com.matrix.system.hive.dao.ShoppingGoodsDao.ShoppingGoodsMap"/> </resultMap> + <!-- 余次使用记录map --> + <resultMap type="com.matrix.system.hive.bean.SysProjUseFlow" id="SysProjUseFlowMap"> + <id property="id" column="id"/> + <result property="createBy" column="create_by" /> + <result property="createTime" column="create_time" /> + <result property="updateBy" column="update_by" /> + <result property="updateTime" column="update_time" /> + <result property="projUseId" column="proj_use_id"/> + <result property="surplusCount" column="surplus_count"/> + <result property="isOver" column="is_over"/> + <result property="failTime" column="fail_time"/> + <result property="price" column="price"/> + <result property="status" column="status"/> + <result property="balance" column="balance"/> + <result property="remark" column="remark"/> + <result property="projName" column="proj_name"/> + <result property="optionType" column="option_type"/> + </resultMap> + <!-- 插入流水 --> + <insert id="insertFlow" parameterType="SysProjUse" useGeneratedKeys="true" + keyProperty="id"> + INSERT INTO sys_proj_use_flow ( + create_by, + create_time, + update_by, + update_time, + id, + proj_use_id, + surplus_count, + is_over, + fail_time, + price, + status, + balance, + remark, + proj_name, + option_type + ) + VALUES ( + #{createBy}, + now(), + #{updateBy}, + now(), + #{id}, + #{projUseId}, + #{surplusCount}, + #{isOver}, + #{failTime}, + #{price}, + #{status}, + #{balance}, + #{remark}, + #{projName}, + #{optionType} + ) + </insert> + + <!-- 查询流水 --> + <select id="selectProjUseFlow" resultMap="SysProjUseFlowMap"> + select * from sys_proj_use_flow + <where> + and proj_use_id=#{record.projUseId} + <if test="record.createBy !=null and record.createBy!='' "> + and instr(createBy,#{record.createBy}) + </if> + <if test="record.beginTime !=null and record.beginTime!=''"> + and create_time >= #{record.beginTime} + </if> + <if test="record.endTime !=null and record.endTime!=''"> + <![CDATA[ and create_time <= #{record.endTime} ]]> + </if> + + </where> + <if test="pageVo !=null"><!-- 判断pageVo对象是否为空 --> + <if test="pageVo.sort !=null and pageVo.order !=null"> + order by + ${pageVo.sort} ${pageVo.order} + </if> + <if test="pageVo.offset >=0 and pageVo.limit >0"> + limit + #{pageVo.offset},#{pageVo.limit} + </if> + </if> + + </select> + + <select id="selectProjUseFlowTotal" resultType="java.lang.Integer"> + select count(*) from sys_proj_use_flow + <where> + and proj_use_id=#{record.projUseId} + <if test="record.createBy !=null and record.createBy!='' "> + and instr(createBy,#{record.createBy}) + </if> + <if test="record.beginTime !=null and record.beginTime!=''"> + and create_time >= #{record.beginTime} + </if> + <if test="record.endTime !=null and record.endTime!=''"> + <![CDATA[ and create_time <= #{record.endTime} ]]> + </if> + + </where> + </select> <!-- 插入方法 --> <insert id="insert" parameterType="SysProjUse" useGeneratedKeys="true" @@ -227,13 +331,17 @@ <select id="selectInPage" resultMap="SysProjUseMap"> select a.*, - b.TIME_LENGTH + b.TIME_LENGTH, + b.img from sys_proj_use a left join shopping_goods b on a.proj_id=b.id where 1=1 <if test="record!=null"> <if test="record.id != null and record.id !='' "> and a.ID = #{record.id} + </if> + <if test="record.queryKey != null and record.queryKey !='' "> + and (instr(b.name, #{record.queryKey}) or instr(b.zjm, #{record.queryKey}) or instr(goods_no, #{record.queryKey})) </if> <if test="record.orderItemId != null and record.orderItemId !='' "> and a.ORDER_ITEM_ID = #{record.orderItemId} @@ -266,7 +374,9 @@ <if test="record.failTime != null "> and a.FAIL_TIME = #{record.failTime} </if> - + <if test="record.targetFailTime != null "> + and date_format(#{record.targetFailTime}, '%Y-%m-%d') > date_format(a.FAIL_TIME, '%Y-%m-%d') + </if> <if test="record.price != null and record.price !='' "> and a.PRICE = #{record.price} </if> @@ -400,10 +510,13 @@ <!-- 根据id查询 --> <select id="selectById" resultMap="SysProjUseMap"> - select * - from sys_proj_use + select a.*, + b.TIME_LENGTH, + b.img + from sys_proj_use a + left join shopping_goods b on a.proj_id=b.id where - id=#{id} + a.id=#{id} </select> <!-- 根据id查询 --> @@ -422,8 +535,11 @@ <!-- 根据对象查询 --> <select id="selectByModel" resultMap="SysProjUseMap"> select - a.* + a.*, + b.time_length, + b.img from sys_proj_use a + left join shopping_goods b on a.proj_id=b.id where 1=1 <if test="record!=null"> <if test="record.id != null and record.id !='' "> @@ -722,4 +838,10 @@ group by b.id) t </select> + <select id="selectHasValidProjUse" resultMap="SysProjUseMap"> + select * from sys_proj_use + where date_format(now(), '%Y-%m-%d') > date_format(FAIL_TIME, '%Y-%m-%d') and STATUS='有效' + </select> + + </mapper> \ No newline at end of file -- Gitblit v1.9.1