|  |  |  | 
|---|
|  |  |  | a.*, | 
|---|
|  |  |  | d.id as orderId, | 
|---|
|  |  |  | b.TIME_LENGTH, | 
|---|
|  |  |  | b.img | 
|---|
|  |  |  | b.img, | 
|---|
|  |  |  | b.code | 
|---|
|  |  |  | from sys_proj_use a | 
|---|
|  |  |  | left join shopping_goods b on a.proj_id=b.id | 
|---|
|  |  |  | left join sys_order_item c on a.ORDER_ITEM_ID=c.id | 
|---|
|  |  |  | 
|---|
|  |  |  | 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> | 
|---|
|  |  |  | <update id="updateInvalidProjUse"  > | 
|---|
|  |  |  | update   sys_proj_use set STATUS='无效' | 
|---|
|  |  |  | where  date_format(now(), '%Y-%m-%d') > date_format(FAIL_TIME, '%Y-%m-%d') | 
|---|
|  |  |  | and STATUS='有效' | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <resultMap type="SysProjUse" id="TaoCanWithProjMap"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <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"/> | 
|---|
|  |  |  | <result property="isOver" column="IS_OVER"/> | 
|---|
|  |  |  | <result property="taocanId" column="TAOCAN_ID"/> | 
|---|
|  |  |  | <result property="vipId" column="VIP_ID"/> | 
|---|
|  |  |  | <result property="failTime" column="FAIL_TIME"/> | 
|---|
|  |  |  | <result property="assembleId" column="ASSEMBLE_ID"/> | 
|---|
|  |  |  | <result property="source" column="SOURCE"/> | 
|---|
|  |  |  | <result property="status" column="STATUS"/> | 
|---|
|  |  |  | <result property="platformFlag" column="PLATFORM_FLAG"/> | 
|---|
|  |  |  | <result property="type" column="type"/> | 
|---|
|  |  |  | <result property="balance" column="balance"/> | 
|---|
|  |  |  | <result property="remark" column="remark"/> | 
|---|
|  |  |  | <result property="price" column="price"/> | 
|---|
|  |  |  | <result property="tcName" column="tcName"/> | 
|---|
|  |  |  | <result property="projName" column="proj_name"/> | 
|---|
|  |  |  | <result property="deductionNum" column="deductionNum"/> | 
|---|
|  |  |  | <result property="isCourse" column="is_course"/> | 
|---|
|  |  |  | <result property="timeLength" column="time_length"/> | 
|---|
|  |  |  | <result property="orderId" column="orderId"/> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <collection property="taocanProjUse" ofType="com.matrix.system.hive.bean.SysProjUse"> | 
|---|
|  |  |  | <id property="id" column="proj_info_id" /> | 
|---|
|  |  |  | <result property="projName" column="proj_proj_name"/> | 
|---|
|  |  |  | <result property="failTime" column="proj_FAIL_TIME"/> | 
|---|
|  |  |  | <result property="surplusCount" column="proj_SURPLUS_COUNT"/> | 
|---|
|  |  |  | <result property="timeLength" column="proj_time_length"/> | 
|---|
|  |  |  | <result property="img" column="proj_img"/> | 
|---|
|  |  |  | <result property="projId" column="proj_projId"/> | 
|---|
|  |  |  | <result property="status" column="proj_status"/> | 
|---|
|  |  |  | </collection> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectTaoCanListWithProj" resultMap="TaoCanWithProjMap"> | 
|---|
|  |  |  | select | 
|---|
|  |  |  | a.*, | 
|---|
|  |  |  | d.id as orderId, | 
|---|
|  |  |  | b.TIME_LENGTH, | 
|---|
|  |  |  | b.img, | 
|---|
|  |  |  | b.code, | 
|---|
|  |  |  | e.proj_name proj_proj_name, | 
|---|
|  |  |  | e.FAIL_TIME proj_FAIL_TIME, | 
|---|
|  |  |  | e.SURPLUS_COUNT proj_SURPLUS_COUNT, | 
|---|
|  |  |  | e.id proj_info_id, | 
|---|
|  |  |  | e.proj_id proj_projId, | 
|---|
|  |  |  | e.status proj_status, | 
|---|
|  |  |  | f.time_length proj_time_length, | 
|---|
|  |  |  | f.img proj_img | 
|---|
|  |  |  | from sys_proj_use a | 
|---|
|  |  |  | left join shopping_goods b on a.proj_id=b.id | 
|---|
|  |  |  | left join sys_order_item c on a.ORDER_ITEM_ID=c.id | 
|---|
|  |  |  | left join sys_order d on c.ORDER_ID=d.id | 
|---|
|  |  |  | left join sys_proj_use e on a.id = e.TAOCAN_ID and e.VIP_ID=a.vip_id | 
|---|
|  |  |  | left join shopping_goods f on e.proj_id=f.id | 
|---|
|  |  |  | where 1=1 and a.type='套餐' and a.TAOCAN_ID IS NULL | 
|---|
|  |  |  | <if test="record.queryKey != null and record.queryKey !='' "> | 
|---|
|  |  |  | and (instr(b.name, #{record.queryKey}) or instr(b.zjm, #{record.queryKey}) or instr(b.goods_no, #{record.queryKey})) | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.isOver != null and record.isOver !='' "> | 
|---|
|  |  |  | and a.IS_OVER = #{record.isOver} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.status != null and record.status !='' "> | 
|---|
|  |  |  | and a.STATUS = #{record.status} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="record.vipId != null and record.vipId !='' "> | 
|---|
|  |  |  | and a.VIP_ID = #{record.vipId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | </mapper> | 
|---|