Merge remote-tracking branch 'origin/main'

main
wanglei 2 years ago
commit a6f9d8f096

@ -1,25 +1,20 @@
package com.ruoyi.szxc.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.szxc.domain.SzxcJmTag;
import com.ruoyi.szxc.service.ISzxcJmTagService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* Controller
@ -69,6 +64,18 @@ public class SzxcJmTagController extends BaseController
return success(szxcJmTagService.selectSzxcJmTagByJmId(jmId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('szxc:jmtag:add')")
@Log(title = "居民标签关联", businessType = BusinessType.UPDATE)
@PostMapping("/addAll")
public AjaxResult addAll(@RequestBody JSONObject json)
{
List<SzxcJmTag> szxcJmTags = json.getJSONArray("szxcJmTags").toJavaList(SzxcJmTag.class);
return toAjax(szxcJmTagService.insertSzxcJmTags(szxcJmTags));
}
/**
*
*/

@ -59,4 +59,6 @@ public interface ISzxcJmTagService
* @return
*/
public int deleteSzxcJmTagByJmId(Long jmId);
int insertSzxcJmTags(List<SzxcJmTag> szxcJmTags);
}

@ -3,9 +3,10 @@ package com.ruoyi.szxc.service.impl;
import com.ruoyi.szxc.domain.SzxcJmTag;
import com.ruoyi.szxc.mapper.SzxcJmTagMapper;
import com.ruoyi.szxc.service.ISzxcJmTagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/**
@ -17,7 +18,7 @@ import java.util.List;
@Service
public class SzxcJmTagServiceImpl implements ISzxcJmTagService
{
@Autowired
@Resource
private SzxcJmTagMapper szxcJmTagMapper;
/**
@ -56,6 +57,32 @@ public class SzxcJmTagServiceImpl implements ISzxcJmTagService
return szxcJmTagMapper.insertSzxcJmTag(szxcJmTag);
}
/**
*
* @param szxcJmTags
* @return
*/
@Override
@Transactional
public int insertSzxcJmTags(List<SzxcJmTag> szxcJmTags) {
int result=1;
try {
if(szxcJmTags!=null&&szxcJmTags.size()>0){
//1.删除该居民id下的所有关联关系
szxcJmTagMapper.deleteSzxcJmTagByJmId(szxcJmTags.get(0).getJmId());
//存储所有的
for(SzxcJmTag szxcJmTag:szxcJmTags){
szxcJmTagMapper.insertSzxcJmTag(szxcJmTag);
}
}
} catch (Exception e) {
result=0;
e.printStackTrace();
}
return result;
}
/**
*
*
@ -91,4 +118,6 @@ public class SzxcJmTagServiceImpl implements ISzxcJmTagService
{
return szxcJmTagMapper.deleteSzxcJmTagByJmId(jmId);
}
}

@ -17,6 +17,8 @@
<select id="selectSzxcJmTagList" parameterType="SzxcJmTag" resultMap="SzxcJmTagResult">
<include refid="selectSzxcJmTagVo"/>
<where>
<if test=" jmId!= null "> and jm_id=#{jmId}</if>
<if test=" tagId!= null "> and tag_id=#{tagId}</if>
<if test="tagName != null and tagName != ''"> and tag_name like concat('%', #{tagName}, '%')</if>
</where>
</select>

Loading…
Cancel
Save