小程序-获取当前用户没有绑定的仪器列表

master
382696293@qq.com 2 years ago
parent aa27beea66
commit e7775f1979

@ -67,5 +67,7 @@ public interface WxInstrumentMapper {
* @param userId * @param userId
* @return * @return
*/ */
List<WxInstrument> selectInstrumentListByUserId(Long userId); List<WxInstrument> selectBindingInstrumentListByUserId(Long userId);
List<WxInstrument> selectUnbindingInstrumentListByUserId(Long userId);
} }

@ -115,7 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<select id="selectInstrumentListByUserId" resultMap="WxInstrumentResult" parameterType="Long"> <select id="selectBindingInstrumentListByUserId" resultMap="WxInstrumentResult" parameterType="Long">
SELECT SELECT
ins.* ins.*
FROM FROM
@ -130,6 +130,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ui.create_time DESC ui.create_time DESC
</select> </select>
<select id="selectUnbindingInstrumentListByUserId" resultMap="WxInstrumentResult" parameterType="Long">
SELECT
ins.*
FROM
wx_instrument ins
WHERE
ins.id NOT IN (
SELECT
ui.instrument_id
FROM
wx_user_instrument ui
WHERE
ui.user_id = #{userId}
AND ui.binding_status = 0
AND ui.`STATUS` = 0
)
ORDER BY ins.sort_no 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()

@ -23,11 +23,19 @@ public class WxInstrumentController extends BaseController {
/** /**
* *
*/ */
@GetMapping(value = "/getInstrumentInfoList") @GetMapping(value = "/bindingInstrumentList")
public R getInstrumentInfoList() { public R bindingInstrumentList() {
return R.ok(wxInstrumentService.getInstrumentInfoList()); return R.ok(wxInstrumentService.bindingInstrumentList());
}
/**
*
*/
@GetMapping(value = "/unbindingInstrumentInfoList")
public R unbindingInstrumentInfoList() {
return R.ok(wxInstrumentService.unbindingInstrumentInfoList());
} }
/** /**

@ -18,6 +18,8 @@ public interface IWxInstrumentService {
void exchangeBinding(String serial); void exchangeBinding(String serial);
List<WxInstrument> getInstrumentInfoList(); List<WxInstrument> bindingInstrumentList();
List<WxInstrument> unbindingInstrumentInfoList();
} }

@ -47,8 +47,13 @@ public class WxInstrumentServiceImpl implements IWxInstrumentService {
private WxUserInstrumentLogMapper wxUserInstrumentLogMapper; private WxUserInstrumentLogMapper wxUserInstrumentLogMapper;
@Override @Override
public List<WxInstrument> getInstrumentInfoList() { public List<WxInstrument> bindingInstrumentList() {
return wxInstrumentMapper.selectInstrumentListByUserId(SecurityUtils.getLoginUser().getWxUserMember().getId()); return wxInstrumentMapper.selectBindingInstrumentListByUserId(SecurityUtils.getLoginUser().getWxUserMember().getId());
}
@Override
public List<WxInstrument> unbindingInstrumentInfoList() {
return wxInstrumentMapper.selectUnbindingInstrumentListByUserId(SecurityUtils.getLoginUser().getWxUserMember().getId());
} }
@Override @Override

Loading…
Cancel
Save