小程序-获取仪器列表

master
382696293@qq.com 2 years ago
parent 4bfd0a9d0f
commit 5bb5236638

@ -62,5 +62,10 @@ public interface WxInstrumentMapper {
*/ */
public int deleteWxInstrumentByIds(Long id); public int deleteWxInstrumentByIds(Long id);
/**
* UserId
* @param userId
* @return
*/
List<WxInstrument> selectInstrumentListByUserId(Long userId);
} }

@ -115,6 +115,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<select id="selectInstrumentListByUserId" resultMap="WxInstrumentResult" parameterType="Long">
SELECT
ins.*
FROM
wx_user_instrument ui
LEFT JOIN wx_instrument ins ON ui.instrument_id = ins.id
WHERE
ui.user_id = #{userId}
AND ui.binding_status = 0
AND ui.`STATUS` = 0
ORDER BY
ins.sort_no DESC,
ui.create_time DESC
</select>
<insert id="insertWxInstrument" parameterType="WxInstrument" useGeneratedKeys="true" keyProperty="id"> <insert id="insertWxInstrument" parameterType="WxInstrument" useGeneratedKeys="true" keyProperty="id">
<selectKey keyProperty="id" resultType="Long" order="AFTER"> <selectKey keyProperty="id" resultType="Long" order="AFTER">
SELECT LAST_INSERT_ID() SELECT LAST_INSERT_ID()

@ -1,16 +1,11 @@
package com.flossom.miniProgram.controller; package com.flossom.miniProgram.controller;
import com.flossom.common.core.domain.R; import com.flossom.common.core.domain.R;
import com.flossom.common.core.exception.ServiceException;
import com.flossom.common.core.utils.StringUtils;
import com.flossom.common.core.web.controller.BaseController; import com.flossom.common.core.web.controller.BaseController;
import com.flossom.common.core.web.domain.AjaxResult;
import com.flossom.miniProgram.service.IWxInstrumentService; import com.flossom.miniProgram.service.IWxInstrumentService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
/** /**
@ -26,6 +21,15 @@ public class WxInstrumentController extends BaseController {
@Autowired @Autowired
private IWxInstrumentService wxInstrumentService; private IWxInstrumentService wxInstrumentService;
/**
*
*/
@GetMapping(value = "/getInstrumentInfoList")
public R getInstrumentInfoList() {
return R.ok(wxInstrumentService.getInstrumentInfoList());
}
/** /**
* *
* *

@ -1,7 +1,10 @@
package com.flossom.miniProgram.service; package com.flossom.miniProgram.service;
import com.flossom.common.core.domain.entity.WxInstrument;
import com.flossom.common.core.domain.entity.WxInstrumentSerial; import com.flossom.common.core.domain.entity.WxInstrumentSerial;
import java.util.List;
/** /**
* Service * Service
* *
@ -14,4 +17,7 @@ public interface IWxInstrumentService {
void binding(String serial); void binding(String serial);
void exchangeBinding(String serial); void exchangeBinding(String serial);
List<WxInstrument> getInstrumentInfoList();
} }

@ -46,6 +46,10 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
@Autowired @Autowired
private WxUserInstrumentLogMapper wxUserInstrumentLogMapper; private WxUserInstrumentLogMapper wxUserInstrumentLogMapper;
@Override
public List<WxInstrument> getInstrumentInfoList() {
return wxInstrumentMapper.selectInstrumentListByUserId(SecurityUtils.getLoginUser().getWxUserMember().getId());
}
@Override @Override
public WxInstrumentSerial getInstrumentInfoBySerial(String serial) { public WxInstrumentSerial getInstrumentInfoBySerial(String serial) {

Loading…
Cancel
Save