| | |
| | | * @return 新增成功的记录数 |
| | | */ |
| | | @ApiOperation(value = "insert") |
| | | @PostMapping("/insert") |
| | | public R<Object> insert(Region region) { |
| | | @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") |
| | | public R<Object> insert(@RequestBody Region region) { |
| | | try { |
| | | return success(regionService.insert(region)); |
| | | } catch (Exception ex) { |
| | |
| | | * @return 新增成功的记录数 |
| | | */ |
| | | @ApiOperation(value = "insert") |
| | | @PostMapping("/insert") |
| | | public R<Object> insert(Simu simu) { |
| | | @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8") |
| | | public R<Object> insert(@RequestBody Simu simu) { |
| | | try { |
| | | return success(simuService.insert(simu)); |
| | | } catch (Exception ex) { |
| | |
| | | * @return 新增成功的记录数 |
| | | */ |
| | | public int insert(Region region) { |
| | | region.setGeomText(); |
| | | return regionMapper.inserts(Arrays.asList(region)); |
| | | } |
| | | |
| | |
| | | * @return 修改成功的记录数 |
| | | */ |
| | | public int updateById(Region region) { |
| | | region.setGeomText(); |
| | | return regionMapper.updates(Arrays.asList(region)); |
| | | } |
| | | } |
| | |
| | | * @return 新增成功的记录数 |
| | | */ |
| | | public int insert(Simu simu) { |
| | | simu.setGeomText(); |
| | | return simuMapper.inserts(Collections.singletonList(simu)); |
| | | } |
| | | |
| | |
| | | * @return 修改成功的记录数 |
| | | */ |
| | | public int updateById(Simu simu) { |
| | | simu.setGeomText(); |
| | | return simuMapper.updates(Arrays.asList(simu)); |
| | | } |
| | | } |
| | |
| | | <insert id="inserts" parameterType="com.se.nsl.domain.po.Region"> |
| | | insert into nsl.region(name, type, geom) values |
| | | <foreach collection="list" item="item" index="index" separator=","> |
| | | (#{item.name}, #{item.type}, ${item.geom}) |
| | | ( |
| | | #{item.name}, |
| | | #{item.type}, |
| | | <choose> |
| | | <when test="item.geom != null and item.geom != ''"> |
| | | ST_GeomFromText('${item.geom}') |
| | | </when> |
| | | <otherwise> |
| | | null |
| | | </otherwise> |
| | | </choose> |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | | |
| | |
| | | update nsl.region |
| | | set name = #{item.name}, |
| | | type = #{item.type}, |
| | | geom = ${item.geom} |
| | | <choose> |
| | | <when test="item.geom != null and item.geom != ''"> |
| | | geom = ST_GeomFromText('${item.geom}') |
| | | </when> |
| | | <otherwise> |
| | | geom = null |
| | | </otherwise> |
| | | </choose> |
| | | where id = #{item.id} |
| | | </foreach> |
| | | </update> |
| | |
| | | now(), |
| | | #{item.createUser}, |
| | | #{item.bak}, |
| | | ${item.geom} |
| | | <choose> |
| | | <when test="item.geom != null and item.geom != ''"> |
| | | ST_GeomFromText('${item.geom}') |
| | | </when> |
| | | <otherwise> |
| | | null |
| | | </otherwise> |
| | | </choose> |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | |
| | | update_time=now(), |
| | | update_user=#{item.updateUser}, |
| | | bak=#{item.bak}, |
| | | geom=${item.geom} |
| | | <choose> |
| | | <when test="item.geom != null and item.geom != ''"> |
| | | geom = ST_GeomFromText('${item.geom}') |
| | | </when> |
| | | <otherwise> |
| | | geom = null |
| | | </otherwise> |
| | | </choose> |
| | | where id = #{item.id} |
| | | </foreach> |
| | | </update> |