标准新增以及编辑时 代替标准号在我的收藏中时,此标准也将插入我的收藏

This commit is contained in:
zhaokaiyao@91isoft.com
2022-01-26 23:02:32 +08:00
parent 59e44f1e7e
commit 4379ede739
10 changed files with 195 additions and 10 deletions
@@ -1,6 +1,7 @@
package com.adc.da.person.dao;
import com.adc.da.base.page.BasePage;
import com.adc.da.person.entity.StandInfo;
import com.adc.da.person.entity.TsPersonCollect;
import com.adc.da.person.page.PersonCollectEOPage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -38,4 +39,5 @@ public interface PersonCollectEODao extends BaseMapper<TsPersonCollect> {
int updateByPrimaryKeySelective(TsPersonCollect tsPersonCollect);
int countPersonCollectByStandInfo(StandInfo standInfo);
}
@@ -0,0 +1,11 @@
package com.adc.da.person.entity;
import lombok.Data;
@Data
public class StandInfo {
private String userId;
private String standCode;
}
@@ -1,6 +1,7 @@
package com.adc.da.person.service;
import com.adc.da.http.ResponseMessage;
import com.adc.da.person.entity.StandInfo;
import com.adc.da.person.entity.TsPersonCollect;
import com.adc.da.person.page.PersonCollectEOPage;
import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -29,4 +30,10 @@ public interface IPersonCollectEOService extends IService<TsPersonCollect> {
public ResponseMessage<IPage<TsPersonCollect>> queryCollectByWrapper(Integer pageNo, Integer pageSize, String collectTitle,String modeType, String userId);
/**
* 通过标准号和用户id查询是否收藏此标准
* @param standInfo
* @return
*/
public int countPersonCollectByStandInfo(StandInfo standInfo);
}
@@ -5,6 +5,7 @@ import com.adc.da.http.ResponseMessage;
import com.adc.da.http.Result;
import com.adc.da.person.dao.PersonCollectEODao;
import com.adc.da.person.dao.PersonNoteEODao;
import com.adc.da.person.entity.StandInfo;
import com.adc.da.person.entity.TsPersonCollect;
import com.adc.da.person.entity.PersonNoteEO;
import com.adc.da.person.page.PersonCollectEOPage;
@@ -156,4 +157,9 @@ public class PersonCollectEOServiceImpl extends ServiceImpl<PersonCollectEODao,
return Result.success(page);
}
@Override
public int countPersonCollectByStandInfo(StandInfo standInfo) {
return personCollectEODao.countPersonCollectByStandInfo(standInfo);
}
}
@@ -403,4 +403,51 @@
from ts_pserson_collect
where collect_type=#{c}
</select>
<select id="countPersonCollectByStandInfo" resultType="java.lang.Integer">
SELECT COUNT(1)
from
ts_person_collect
WHERE
VALID_FLAG ='0'
AND USER_ID = #{userId}
AND COLLECT_RES_ID =
(
SELECT
id
FROM
sar_standards_info AS sarInfo
WHERE
VALID_FLAG = '0'
AND
(
(
REPLACE (
concat(
sarInfo.STAND_SORT,
' ',
sarInfo.STAND_NUMBER,
'-',
sarInfo.STAND_YEAR
),
' ',
''
) = REPLACE (
#{standCode},' ', '')
AND sarInfo.STAND_YEAR != ''
)
OR (
REPLACE (
concat(
sarInfo.STAND_SORT,
sarInfo.STAND_NUMBER
),
' ',
''
) = REPLACE ( #{standCode},' ', '')
)
)
)
</select>
</mapper>